+ 3
You have an infinite loop.
i starts at 1 & decrements each iteration, so it will always be smaller than 10.
I am assuming the Sololearner server timed out and shut down your program
+ 2
PRINCE That's because the conditions aren't meant for that Code Form and need slight chages to Work:
You see the Part i++ says that i=i+1 and when do that so many Times at some Point is i == 10 but with i=i -1 and the starting Point from 1 it will never be i==10 at most i==-10.
By i++:
1. Loop i= 1+1 == 2
2. Loop i= 2+1 == 3
3. Loop i= 3+1 == 4
...
By i --:
1. Loop i= -1+1 == 0
2. Loop i= -2+1 == -1
3. Loop i= -3+1 == -2
...
You could change the Deklaration Like that then it would work:
Int main()
{
int i= 10;
while (i >= 1)
{
cout<< i<< "\n";
i--;
}
return 0;
}