Read and print elements of the array with C.
#include <stdio.h>
int main()
{
int arr[100];
int i, N;
printf("Enter size of array: ");
scanf("%d", &N);
printf("Enter %d elements in the array : ", N);
for (i = 0; i < N; i++)
{
scanf("%d", &arr[i]);
}
printf("\nElements in array are: ");
for (i = 0; i < N; i++)
{
printf("%d ", arr[i]);
}
return 0;
}
Output:-
Enter size of array : 5
Enter 5 elements in the array : 10 20 30 40 50
Elements in array are : 10 20 30 40 50
0 Comments