Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.Numerics;
- using System.Threading;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- Console.Write("Enter integer between 1 and 100: ");
- CalcFact(int.Parse(Console.ReadLine()));
- Console.ReadKey();
- }
- private static void CalcFact(int input)
- {
- BigInteger fact = input;
- for (int i = input - 1; i >= 2; i--)
- {
- fact = fact * i;
- Thread.Sleep(200);
- Console.WriteLine("{0}", fact);
- Thread.Sleep(0);
- }
- Console.WriteLine("\nFactorial of {0} is: {1} ", input, fact);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment