Advertisement
martinvalchev

Factorial

Feb 2nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace Factorial
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int number = int.Parse(Console.ReadLine());
  11.             BigInteger factorial = GetFactorial(number);
  12.             Console.WriteLine(factorial);
  13.         }
  14.  
  15.         static BigInteger GetFactorial(int number)
  16.         {
  17.             BigInteger factorial = 1;
  18.             for (int i = 1; i <= number; i++)
  19.             {
  20.                 factorial *= i;
  21.             }
  22.             return factorial;
  23.         }
  24.     }
  25.        
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement