Starting Vocational Training From 1-May-2024 Get Detail
Write a program in C to store elements in an array and print it.
Test Data :
Input 10 elements in the array :
element - 0 : 1
element - 1 : 1
element - 2 : 2
.......
Expected Output :
Elements in array are: 1 1 2 3 4 5 6 7 8 9
#include <stdio.h>
void main()
{
int arr[10];
int i;
printf("
Read and Print elements of an array:
");
printf("-----------------------------------------
");
printf("Input 10 elements in the array :
");
for(i=0; i<10; i++)
{
printf("element - %d : ",i);
scanf("%d", &arr[i]);
}
printf("
Elements in array are: ");
for(i=0; i<10; i++)
{
printf("%d ", arr[i]);
}
printf("
");
}