;

# C# Program To Print Factorial Of A Number

###### Tutorialsrack 04/08/2019 C# Programs

In this C# program, we will learn how to write a program to print factorial of a number.

## What is Factorial Number?

In mathematics, the factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n:

n!=(n-1)x(n-2)x(n-3)x….3x2x1

The factorial, symbolized by an exclamation mark (!), is a quantity defined for all integers greater than or equal to 0.

For example,

5!=5x4x3x2x1=120

6!=6x5x4x3x2x1=720

The value of 0! is 1.

Here is the code of the program to print factorial of a number:

##### Code - C# Program To Print Factorial Of A Number.
``````using System;

namespace TutorialsrackPrograms
{
class Program
{
//c# program to print factorial of a number.
static void Main(string[] args)
{
int i, fact = 1, number;
Console.Write("Enter any Number: ");
for (i = 1; i <= number; i++)
{
fact = fact * i;
}
Console.Write("Factorial of " + number + " is: " + fact);
}
}
}``````
##### Output

Enter any Number: 5
Factorial of 5 is: 120