Factorial Program using C#

This is the basic program for the beginners.

Here's how to find the factorial of 3.

Mathematically it follows like th


class FactorialProgram
static void Main(string[] args)
            var fp =
new FactorialProgram();
Console.Write("\n Enter the number:\t");
result = fp.fact(int.Parse(Console.ReadLine()));

int fact(int num)
int temp = 1;
for (int i = num; i > 1; i--)
                temp = temp * i;
return temp;


Popular posts from this blog

Exporting to excel from a custom class object using C#.NET

Get the Clicked Cell Value and Column Name of GridView in ASP.NET

How to hide bootStrap popover when user click(s) outside the popover?