1 2 3 4 5 6 7 8 9 10 |
public class Numbers { public static void main(String[] args) { int number = 42; for (int i = 1; i <= 1000; i++) { number = number * 37 % 103; } int number2 = number * number; System.out.println("result = " + number2); } } |
continued on the next slide...
i
and number
.
When you want it to continue, you can hit the button that looks like the
standard "play" icon of a right-pointing arrow. Using this
approach, fill in the table below indicating what
value number
has when i
has the given value.
Keep in mind that you are figuring out what value number
has
just before it executes this line of code.
i = 1 |
42 |
|
i = 2 |
9 |
|
i = 3 |
24 |
|
i = 4 |
64 |
continued on the next slide...
number
after the loop is done executing. Again hit the
"play" button to start the programming running again. What value
does number
have at line 7?
69