Vidyalelo
C# Programming · Q210

Classes and Objects in C Sharp

Programming · C# Programming · question 210

Q210

What will be the output of the following C# code snippet? class maths public int fact(int n) int result; if (n == 2) return 1; result = fact(n - 1) * n; return result; class Program static void Main(string[] args) maths obj = new maths(); Console.WriteLine(obj.fact(4)); Console.ReadLine();

A.
24
B.
0
C.
12
Answer
D.
1

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board