add csharp examples (#10)
This commit is contained in:
committed by
Aditya Bhargava
parent
c3396b8b0a
commit
62ed616954
19
03_recursion/csharp/03_factorial/Program.cs
Normal file
19
03_recursion/csharp/03_factorial/Program.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace ConsoleApplication
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine(Fact(5));
|
||||
}
|
||||
|
||||
private static int Fact(int x)
|
||||
{
|
||||
if (x <= 1) return 1;
|
||||
|
||||
return x * Fact(x - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user