->Write a program to find the factorial of input the given number ?
class Program
{ static void Main(string[] args)
{
int i, number, fact;
Console.WriteLine("Enter the number");
number = int.Parse(Console.ReadLine());
fact = number;
for (i = number - 1; i >= 1; i--)
{
fact = fact * i;
}
Console.WriteLine("Result: {0}",fact);
Console.ReadLine()
}
}
OUTPUT:Enter the number
5
Result: 120
No comments:
Post a Comment