Advertisement
remote87

SomeFactorials

Aug 21st, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Numerics;
  7.  
  8. namespace SomeFactorials
  9. {
  10.     class SomeFactorials
  11.     {
  12.         static void Main()
  13.        
  14.         {          
  15.             int i, number;
  16.             Console.WriteLine("Enter a number to find the factorials");
  17.             number = int.Parse(Console.ReadLine());
  18.             BigInteger fact = number;
  19.             for (i = number - 1; i >= 1; i-- )
  20.             {
  21.                 fact = fact * i;              
  22.             }          
  23.             Console.WriteLine("Factorial of the given number is: {0}", fact);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement