• 6
  • Locked
You need to write a program that: 1. Reads an integer N from the console. 2. If the number N is greater than 0, then the program reads an additional N integers. 3. Print the numbers to the console. If N is odd, display them in the order in which there were entered. Otherwise, display them in reverse
You can't complete this task, because you're not signed in.
Comments (4)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 14 , Mumbai , India
14 September 2022, 16:04
Not able to understand problem clearly. If sample examples were there it will be much helpful
Attila Kiss
Level 8 , Hungary
27 September 2022, 21:21
it shall work like this: you open a console, whick reads a number, you type in, its declared as "N". that number will be the lenght of your new array. then you need to store "N" many numbers read from the console in that new array. So if your first number was 5 - the console should read 5 more numbers, and store them in your new array. The order of the numbers depends on if they are even or odd. Once they are stored at the right index, they shall be printed in new lines. for example you enter: 5 - that will be "N". becasue its an odd number, the followin numbers will stored in normal order: 1 @ index 0 2 @ index 1 3 @ index 2 4 @ index 3 5 @ index 4 And then just print all these numbers - expected output is: 1 2 3 4 5 . If "N" was 4 it would look like this: Input: 1 2 3 4 Output: 4 3 2 1
Attila Kiss
Level 8 , Hungary
27 September 2022, 21:24
I agree tho, the hardest part of these excercises is to understand what is expected. Samples would be great.
Level 12 , Earth, Germany
13 August 2022, 17:16 I the only dumb one here, who doesn't find the solution on the first run? 😅