0

Array value display error.

When i execute the code on Dev C++, the program finishes when the first "for" stops. What i wanted to do was to display the values of the array in an inverted order. Here's the code: https://code.sololearn.com/c2y5yzVKDMAU/#cpp Any help and feedback will be appreciated.

30th Mar 2020, 5:13 AM
Oscar Ramírez Díaz
Oscar Ramírez Díaz - avatar
2 Réponses
+ 1
Body of the loop in line 16 is never executed because it has wrong condition (i==0) line #16 should be for(int i=number-1;i>=0;i--){ also if you want to input an integer "number" of times line #10 should be for(int i=0;i<number;i++){ (not i <=number, as in this case you will input an integer "number" +1 times)
30th Mar 2020, 6:29 AM
andriy kan
andriy kan - avatar
0
Thanks!
30th Mar 2020, 6:50 AM
Oscar Ramírez Díaz
Oscar Ramírez Díaz - avatar