Why does it shows endless 10 and the decrement "x--" doesn't work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does it shows endless 10 and the decrement "x--" doesn't work?

#include <iostream> using namespace std; int main() { int x=10; while (x>=0) cout<<x<<endl; x--; return 0; }

22nd Apr 2022, 8:02 AM
Emma
Emma - avatar
1 Answer
+ 3
Cause you forgot the brackets around the while statement
22nd Apr 2022, 8:12 AM
Slick
Slick - avatar