Factorial program in C#

In this post, we will learn about Factorial program in C# with an example.


In my previous posts I have explained various topics like Get site visitor count in asp.net
Convert generic list to datatable in Asp.Net C#.Net, Abstract Class in C# with Example,
Routing in Asp.Net MVC with Example
,Use of Global.asax in Asp.net

Now in this post, I will explain the Factorial program in C# with appropriate example. Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!.
For example:
3! = 3*2*1 = 6
Now create Console Application in Visual Studio and write below lines of code in it.

using System;

namespace SCS
    class Program
        static void Main()
            // Program to find Factorial of number
            int i, _Fact = 1, _Number;

            Console.Write("Enter any Number: ");
            _Number = int.Parse(Console.ReadLine());
            for (i = 1; i <= _Number; i++)
                _Fact = _Fact * i;
            Console.Write("Factorial of " + _Number + " is: " + _Fact);  

Read :


You can also read about ASP.NET, C#.Net, JQUERY, AJAX, JavaScript
I hope you get an idea about Factorial program in C#.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you liked this post, don’t forget to share this.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *