What will be the output of the following C# code snippet? [code] class maths { public int fact(int n) { int result;

What will be the output of the following C# code snippet?
Code:
 class maths
 {
     public int fact(int n)
     {
         int result;
         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. 30
C. Compile time error
D. Runtime Error
 

Tìm kiếm

Back
Top