Recursive Multiplication Method
What is printed as a result of executing the following program?
public class Multiply {
public static int multiply(int a, int b) {
if(b == 0)
return 0;
return a + multiply(a, b - 1);
}
public static void main(String[] args) {
System.out.println(multiply(6, 4));
}
}
A
10
B
18
C
24
D
20
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | richa.tuli | 2 | 2 | 0m 03s | 197 |
| #2 | busemagngr | 2 | 2 | 0m 38s | 162 |
| #3 | yekeon0515 | 1 | 1 | - | 100 |
| #4 | lsj08030922 | 1 | 1 | 2h 12m | -7,853 |
Items per page:
10
1 – 4 of 4
