50. WRITE A C PROGRAM TO DECLARE SINGLE-DIMENSIONAL ARRAY READ VALUES INTO ARRAY AND PRINT IT.

/* program to declare single dimensional array*/

#include<stdio.h>
#include<conio.h>
int main()
{
int a[5];
clrscr();
printf(“enter the values into array”);
for(i=0;i<5;i++)
{
scanf(“%d”,&a[i]);
}
printf(“the elements of the array elements are: \n”);
for(i=0;i<5;i++)
printf(“a[%d]=%d\n”,a[i]);
getch();
return 0;
}

output

enter the values into array
8
26
14
37
11
the elements in the array are
a[0]=8
a[1]=26
a[2]=14
a[3]=37
a[4]=11

Comments