Tuesday, 8 July 2014

A PROGRAM TO READ AND PRINT ELEMENTS IN A SINGLE DIMENSIONAL ARRAY

A PROGRAM TO READ AND PRINT ELEMENTS IN A SINGLE DIMENSIONAL ARRAY

#include<stdio.h>
#include<conio.h>
void main( )
{
int n,i,a[20];
clrscr ( );
printf ("enter number of terms in the array\n");
scanf ("%d",&n);
printf ("enter elements in the array\n");
for( i=0 ; i < n ; i++ )
{
scanf ("%d", &a[i] );
}
printf ("the elements are\n");
for ( i = 0 ; i < n ; i++)
{
printf ("%d" , a[i] );
}
getch( );
}