Nested For Loop Iteration Count
How many times will the println statement be executed by the following code segment?
for (int i = 1; i <= 3; i++) {
for (int j = i; j <= 5; j++) {
System.out.println(i + "-" + j);
}
}
A
10
B
9
C
11
D
12
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | singhris000 | 1 | 1 | 0m 49s | 51 |
| #2 | bommasam000 | 3 | 6 | 4m 09s | 21 |
| #3 | chasequest8 | 0 | 1 | 0m 03s | -13 |
| #4 | richa.tuli | 0 | 1 | 0m 25s | -35 |
APFIVE