C Sharp Program Factorial Method
using System; namespace FactorialCalculator { class Program { static long Factorial(int n) { long fact = 1; for (int i = 1; i <= n; i++) { fact = fact * i; } return fact; } static void Main(string[] args) { int n; Console.Write("Enter a number to find its factorial: "); n = int.Parse(Console.ReadLine()); long result = Factorial(n); Console.WriteLine("Factorial="+result); Console.ReadKey(); } } } Output: