32 lines
674 B
C#
32 lines
674 B
C#
|
/*
|
||
|
* C# Program to Generate the Factorial of Given Number
|
||
|
*/
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace factorial
|
||
|
{
|
||
|
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("\nFactorial of Given Number is: "+fact);
|
||
|
Console.ReadLine();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
Enter the Number
|
||
|
6
|
||
|
Factorial of Given Number is: 720
|