Advertisement
bacco

Factorial

May 28th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4.  
  5. class MainClass
  6. {
  7.     static void Main()
  8.     {
  9.         BigInteger  num = BigInteger.Parse(Console.ReadLine());
  10.         FactorialCalc(num);
  11.     }
  12.  
  13.     static void FactorialCalc(BigInteger  num)
  14.     {
  15.         BigInteger sum = num;
  16.         for (BigInteger i = num - 1 ; i >= 1; i--)
  17.         {
  18.             sum *= i;
  19.         }
  20.         Console.WriteLine(sum);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement