ASP.NET MVC, MVC, C#, PYTHON, JQUERY

Friday, September 7, 2018

How to Find Factorial Using C#

            How to Find Factorial  Using C#

using System;
namespace FactorialDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            int iCount, iUserNumber, iFact;
            Console.WriteLine("Please Enter A Number For Finding Factorial ");
            iUserNumber = Convert.ToInt32(Console.ReadLine());
            iFact = iUserNumber;
            for (iCount = iUserNumber  - 1; iCount >= 1; iCount--)
            {
                iFact = iFact * iCount;
            }
            Console.WriteLine("Factorial of Entered Number {0}", iFact);
            Console.ReadLine();
        }
    }
}
Share:

2 comments:

SOCIAL PROFILES

Search This Blog

Powered by Blogger.

Fixed Menu (yes/no)

yes

Contact Form

Name

Email *

Message *

Tags

Ads Section

Tags

ASP.NET MVC (7) C# (11) jQuery (1)