/* File: input2.c Have the user type in a bunch of numbers */ #include #define MAX_SIZE 20 int main() { int i, n ; // declare and initialize array int A[MAX_SIZE] ; printf("How many numbers do you have? ") ; scanf("%d", &n) ; if (n > MAX_SIZE) { printf("That's too many!\n") ; return 0 ; } for (i = 0 ; i < n ; i++) { printf("A[%d] = ? ", i) ; scanf("%d", &A[i] ) ; } printf("\n\nHere's what you typed in:\n") ; for (i = 0 ; i < n ; i++) { printf("A[%d] = %d\n", i, A[i]) ; } return 0 ; }