Complete the code to return 1 when n is 0 in the factorial function.
if (n == 0) return [1];
The factorial of 0 is defined as 1, so the function should return 1 when n is 0.
Complete the recursive call to calculate factorial of n.
return n * Factorial([1]);
The factorial function calls itself with n-1 to reduce the problem size until it reaches 0.
Fix the error in the factorial function header to make it recursive.
public static int Factorial([1] n) {The factorial function should take an integer parameter because factorial is defined for integers.
Fill both blanks to complete the factorial function with base case and recursive call.
if (n == [1]) return [2]; return n * Factorial(n - 1);
The base case is when n is 0, return 1. Otherwise, multiply n by factorial of n-1.
Fill all three blanks to complete the factorial function with parameter, base case, and recursive call.
public static int Factorial([1] n) { if (n == [2]) return [3]; return n * Factorial(n - 1); }
The function takes an int parameter n, returns 1 if n is 0, else returns n times factorial of n-1.
