Question 8
Not yet
answered
Flag question
What will be the output of the following code snippet?
public class Main {
public static void main(String[] args) {
System.out.println(foo(5));
}
}
}
public static int foo(int n) {
if (n <= 1) {
return 1;
}
return n * foo(n - 1);
○ A. 6
B. 5
C. 120
O D. 24