Java Reference
In-Depth Information
(e) Executes body 5 times.
Output is
bbbbbabbbbb
(f) Executes body 7 times.
Output is
10
5
2
1
0
0
0
2. (a) int n = 1;
while (n <= max) {
System.out.println(n);
n++;
}
(b) int total = 25;
int number = 1;
while (number <= (total / 2)) {
total = total - number;
System.out.println(total + " " + number);
number++;
}
(c) int i = 1;
while (i <= 2) {
int j = 1;
while (j <= 3) {
int k = 1;
while (k <= 4) {
System.out.print("*");
k++;
}
System.out.print("!");
j++;
}
System.out.println();
i++;
}
(d) int number = 4;
int count = 1;
while (count <= number) {
System.out.println(number);
number = number / 2;
Search WWH ::




Custom Search