The Factorial


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Training
{
    class Program
    {
        static void Factorial(int number)
        {
            int factorial = 1;
            for (int i = number; i > 0 ; i--)
            {
                factorial *= i;
            }
            Console.WriteLine("Factorial is : " + factorial);
        }

        static void Main(string[] args)
        {
            Console.Write("Input your number:  ");

           int number = Convert.ToInt32(Console.ReadLine());
            
            Factorial(number);
        }
    }
}

                                            Result









Комментарии