Here is the loop for reference.
int r = 2; int n = 1; while(n < 10) { if(n % 2 == 0) { n = n + 1; r = r * r; } }
n | r | |
1 | 2 | |
2 | 2 | |
3 | 4 | |
4 | 4 | |
5 | 16 | |
6 | 16 | |
7 | 32 | |
8 | 32 | |
9 | 64 | |
10 | 64 |
The last line shows the values of n and r when the top of the loop is reached but the loop is finished.