C Program using an array with a loop
In this program, You will learn how to implement an array with a loop in c.
for (int i = 0; i < 10; i++) {
cin >> arr[i];
}
Example: How to implement an array with a loop in c.
#include<stdio.h>
int main() {
int arr[10], i;
printf("Enter 5 numbers:");
for (i = 0; i < 5; i++) {
scanf("%d", &arr[i]);
}
printf("List of Array:");
for (i = 0; i < 5; i++) {
printf("%d ", arr[i]);
}
return 0;
}
Output:
Enter 5 numbers:10 20 30 40 50
List of Array:10 20 30 40 50