while statement help
I know that -- descrease the number and ++ increases the number. Does it just decrease by 1 or is it based on something else?
1 2 3 4 5 6 7 8 9 10
|
int x=2
int y=10
while (x<y)
{if ((i%2)==0)
x++:
else
y--;
}
cout<<x<<endl;
|
So if I understand that correctly, y should be 3 and the output should also be 3
i think you want.
instead of
http://cpp.sh/35h6z
you are correct -- decrease by 1 and ++ increase by 1.
Last edited on
Thank you!
Topic archived. No new replies allowed.