Java Reference
In-Depth Information
34.
The output is too long to reproduce here. The pattern is as follows:
1 times 10 = 10
1 times 9 = 9
.
.
.
1 times 1 = 1
2 times 10 = 20
2 times 9 = 18
.
.
.
2 times 1 = 2
3 times 10 = 30
.
.
.
35.
a. A
for
loop
b. and c. Both require a
while
loop because the input list might be empty. (A
for
loop also might work, but a
do-while
loop definitely would not work.)
36.
This is an infinite loop. The first few lines of output are
10
13
16
19
21
37.
This is an infinite loop. The first few lines of output are
n == 1
limit == 10;
n == 2
limit == 3
n == 3
limit == 4
n == 4
limit == 5
38.
8
6
The end.
39.
8
6
2
0
The end.