+ 1
how is the output 12345678910
int i = 10; while(i--) cout << 10 - i;
4 Respostas
+ 5
As in your while loop it specifies that while(i--) it means that it will first evaluate th value of 'i' and then decrement it
That's why you are getting ths output
At first itteration value that is evaluated is 10 and after that it has been decreased to 9
Similarly at last the value to be evaluated is 1 and after that it is decreased to 0
+ 3
Ariz imam that's because you are printing '10-i' not 'i'
+ 1
Arsenic ok mate..
0
why the thread of output is in reverse.. it should be 10987654321