For my java homework I have to provide a trace table for the following loop:
int i = 10; int j = 0; int n = 0;
while (i > 0) { i--; j++; n = n + i - j; }
When I put it into eclipse I get the answer:
i= 0
j= 10
n= -10
but when I try to trace it by hand I get
i j n i>0
10 0 0 t
9 1 8 t
8 2 14 t
7 3 18 t
6 4 20 t
5 5 20 t
4 6 18 t
and so on.... Can someone please tell me why eclipse only prints out the last line? It didn't with any of the other trace tables I was trying to check my work on