OK, well here are some tips about saving space:
1. The 3 loops could be merged, doing all of the task in just one loop.
2. Instead of that if-clause, you could use shorter syntax. Let me give you an example:
- int a = 3;
-
int b = a<10 ? 1 : 2; // this means: if a<10 is true, then the expression in brackets will result in 1, otherwise in 2
So, if you adapt that, you can save some space.
Oh, and the tasks tells you that the series of numbers is terminated by EOF, not that you have exactly 4 numbers. So read them in one by one and operate on them or take them as arguments for the program.
One more thing: If I enter 3, should it give me 3 (which is an odd number) or 5 (which is the next highest odd number)?
Greetings,
Nepomuk