February 24, 2020

# Write a C# program to find factorial of a number

How to Write a C# program to find factorial of a number.

# What is Factorial Number?

A factorial number is multiplication of all the smaller and equal numbers of **N. **where **N** is a positive number.

**Example: Find a factorial of 5.**

*Output: 5! = 5*4*3*2*1 = 120*

## C# program to find the fatcorial number.

using System; namespace CSharpProgram { class Program { static void Main(string[] args) { int i, fact = 1, n; Console.Write("Enter number to find the factorial: "); n = int.Parse(Console.ReadLine()); for (i = 1; i <= n; i++) { fact = fact * i; } Console.Write("Factorial of " + n + " is: " + fact); Console.ReadLine(); } } }