fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. size_t n;
  5. printf("How many numbers would you like to enter?\n");
  6. scanf("%zu", &n);
  7. int array[n];
  8. for (size_t i = 0 ; i != n ; i++) {
  9. printf("Enter number %zu: ", i+1);
  10. scanf("%d", &array[i]);
  11. }
  12. printf("You entered: ");
  13. for (size_t i = 0 ; i != n ; i++) {
  14. printf("%d ", array[i]);
  15. }
  16. printf("\n");
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 2116KB
stdin
8
1
3
5
7
9
11
13
15
stdout
How many numbers would you like to enter?
Enter number 1: Enter number 2: Enter number 3: Enter number 4: Enter number 5: Enter number 6: Enter number 7: Enter number 8: You entered: 1 3 5 7 9 11 13 15