Enter and display elements in 1D array

#include<stdio.h>
#include<conio.h>
int main()
{
int n,i,a[20];
clrscr();
printf("Enter number of elements");
scanf("%d",&n);
printf("Enter array elements \n" );
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\n displaying array elements");
for(i=0;i<n;i++)
{
printf("\t %d",a[i]);
}
getch();
return 0;
}

0 comments:

Post a Comment