how many times the code executes ?

how many times will this executes >

1
2
3
4
5
6
int j = 5;
int i = 100;
while (i<j)
{
i--;
}
When will 100 ever be less than 5?

Edit

Anyways why can't you compile it and output i? :P
Last edited on
tried to compile got 100,
does i-- affect the execution ?
so it would be 95 right ?
If you did what I said and got 100 as a result then remember the initial value was 100 so it would mean that 100(start) - 100(end) = 0 which means it iterated 0 times. It never executes. As I mentioned earlier 100 will never be less than 5 and that is the only time it will execute.
Topic archived. No new replies allowed.