How do you use Scanf to enter integers into the array in C?
#include <stdio.h> int main() { int i, n; printf("Enter the number of integers you want to enter: "); scanf("%d", &n); int arr[n]; printf("Enter %d integers: ", n); for (i = 0; i < n; i++) { scanf("%d", &arr[i]); } printf("You entered: "); for (i = 0; i < n; i++) { printf("%d ", arr[i]); } return 0; }
2 thoughts on “<strong>How do you use Scanf to enter integers into the array in C?</strong>”