What line of code should be inserted?

You are employed as a developer at ABC.com. You make use of C# and ASP.NET for
development purposes.
You have been instructed to create a new application that should include a recursive method that
computes the factorial of a number.
You have written the following code for the method:
01: public static int Factorial(int n)
02: {
03: if (n == 0)
04: {
05: return 1;
06: }
07: else
08: {

09:
10: }
11: }
You have to insert suitable code at line 09 to make sure that the proper outcome is reached.
What line of code should be inserted?

You are employed as a developer at ABC.com. You make use of C# and ASP.NET for
development purposes.
You have been instructed to create a new application that should include a recursive method that
computes the factorial of a number.
You have written the following code for the method:
01: public static int Factorial(int n)
02: {
03: if (n == 0)
04: {
05: return 1;
06: }
07: else
08: {

09:
10: }
11: }
You have to insert suitable code at line 09 to make sure that the proper outcome is reached.
What line of code should be inserted?

A.
return n * Factorial(n – 1);

B.
return n;

C.
return n * Factorial(n – 0);

D.
return 0;



Leave a Reply 1

Your email address will not be published. Required fields are marked *