Skip to content

Commit 074c449

Browse files
nvillan16tstreamDOTh
authored andcommitted
Add C# factorial algorithm (#344)
1 parent 2b073da commit 074c449

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Maths/Factorial/C#/Factorial.cs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
 class Factorial
2+
{
3+
public static long factorial(int inputNum)
4+
{
5+
if (inputNum == 1)
6+
{
7+
return 1;
8+
}
9+
else
10+
{
11+
return inputNum * factorial(inputNum - 1);
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)