using System;
public class Program
{
//Using recursion
static long Factorial(long number)
{
return ((number <= 1) ? 1 : number * Factorial(number - 1));
}
static void Main(string[] args)
{
long numToFindFact = 6;
Console.WriteLine("The factorial of " + numToFindFact + " is: {0}\n", Factorial(numToFindFact));
}
}
No comments:
Post a Comment