#include <stdio.h> int main(void) { size_t n; printf("How many numbers would you like to enter?\n"); scanf("%zu", &n); int array[n]; for (size_t i = 0 ; i != n ; i++) { printf("Enter number %zu: ", i+1); scanf("%d", &array[i]); } printf("You entered: "); for (size_t i = 0 ; i != n ; i++) { printf("%d ", array[i]); } printf("\n"); return 0;}
8 1 3 5 7 9 11 13 15
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
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!