Find factorial of a number in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FactorialNumber\_ForLoop
{
class Program
{
static void Main(string\[\] args)
{
int number, fact = 1;
Console.WriteLine("Enter the number");
number = int.Parse(Console.ReadLine());
for (int i = number; i >=1; i--)
{
fact = fact \* i;
}
Console.WriteLine("{0} Factorial is {1}",number,fact);
}
}
}
Output: Enter the number 5 5 Factorial is 120