confused!

why is the output of this program is
0
1
1
1
i set x = 0; i dont understand how it gets 1

1
2
3
4
5
6
7
8
 y=5;
		for(x=0; x<y; x++)
		{
			cout<<(x)<<endl;
			x=0;
			y--;
			
		}
Line 5: x is set to 0
Line 8: x is incremented to 1 and loop starts again
Line 4: x (1) is outputted
Line 5: x is set to 0
...
Last edited on
Topic archived. No new replies allowed.