- 1

C++ loop 1 to 10 then reverse

my output should be: 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 0 this is my code the number 9 is disappearing pls helpp https://www.sololearn.com/compiler-playground/c3sLQ7r55Q50

27th Oct 2022, 1:54 PM
soupie
2 Answers
+ 2
For example: Create a loop from 1 to 10. Create a loop from 9 to 1. Please link your code if you want us to test it.
27th Oct 2022, 2:04 PM
Lisa
Lisa - avatar
0
for(int x=1; x<=10; x++) cout << x << endl; for(int x=9; x>=0; x--) cout << x << endl;
27th Oct 2022, 5:21 PM
SoloProg
SoloProg - avatar