// Read integers until a negative integer is read // and then print odd and even integers on separate lines #include #define MAX_NUMBERS 1001 // Let's try and think of a smart way to do this, there are a number // of different ways to solve - what are some thoughts? int main(void) { int number[MAX_NUMBERS] = {0}; int i = 0; while ((scanf("%d", &number[i]) == 1) && number[i] >= 0 && i < MAX_NUMBERS - 1) { i++; } printf("Odd numbers:"); for (i = 0; i < MAX_NUMBERS; i++) { if(number[i] % 2 != 0) { printf("%d ", number[i]); } } printf("Even numbers:"); for (i = 0; i < MAX_NUMBERS; i++) { if(number[i] % 2 == 0) { printf("%d ", number[i]); } } return 0; }