Advertisement
FLISEN

Untitled

Jan 18th, 2013
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4.     class FactorialN
  5.     {
  6.         static void Main()
  7.         {
  8.             Console.WriteLine("Enter n! - from 0 to 100: ");
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             FactorialCalculation(n);
  12.  
  13.         }
  14.  
  15.         private static void FactorialCalculation(int n)
  16.         {
  17.             BigInteger factorial = 1;
  18.  
  19.             for (int i = 1; i <= n; i++)
  20.             {
  21.                 factorial *= i;
  22.             }
  23.  
  24.             Console.WriteLine("{0}! = {1}", n, factorial);
  25.         }
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement