Search This Blog

This website completely moved to new domain. For latest content, visit www.programmingposts.com

C# Program to Find Factorial of Number

C# Program to find Factorial of Given Number

using System;

namespace FactorialOfNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            int num, i, fact = 1;
            //clrscr();
            Console.WriteLine("\n >>C# PROGRAM TO FIND FACTORIAL OF GIVEN NUMBER <<\n");
            Console.Write("\n Enter the Number whose Factorial you want: ");
            num=Convert.ToInt32(Console.ReadLine());
            for (i = num; i >= 2; i--) //i is intializing with num value and  is decremented till 2
            {
                fact = fact * i; //fact is updating with changing value of i
            }

            Console.WriteLine("\n The factorial of {0} is {1}.\n\n", num, fact);
            Console.ReadLine();
        }
    }
}
Output:


14 comments:

  1. Add more questions and answers

    ReplyDelete
  2. nic post
    http://mkniit.blogspot.in

    ReplyDelete
  3. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.

    rpa Training in Chennai

    rpa Training in bangalore

    rpa Training in pune

    blueprism Training in Chennai

    blueprism Training in bangalore

    blueprism Training in pune

    iot-training-in-chennai

    ReplyDelete
  4. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.

    rpa Training in Chennai

    rpa Training in bangalore

    rpa Training in pune

    blueprism Training in Chennai

    blueprism Training in bangalore

    blueprism Training in pune

    iot-training-in-chennai

    ReplyDelete
  5. UiPath Training in Bangalore by myTectra is one the best UiPath Training. myTectra is the market leader in providing Robotic Process Automation on UiPath
    ui path training in bangalore

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    Sap Abap Training From India

    ReplyDelete
  8. It is very good and very informative. There is a useful information in it.Thanks for posting...
    https://www.apponix.com/

    ReplyDelete