using System;
public class Program
{
public static void Main()
{
Program pr = new Program();
long fact = pr.factorial(10);
Console.WriteLine('factorial of {0} is : {1}',10,fact);
}
public long factorial(long n) {
if (n == 1)
return 1;
else
return (n * factorial(n - 1));
}
}
Output.
factorial of 10 is : 3628800
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Output.
factorial of 10 is : 3628800