Advertisement
SSkrev

TrailingZeroes

Mar 24th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. class TrailingZeroesInN
  5. {
  6.     static void Main()
  7.     {
  8.         Console.Write("n=");
  9.         BigInteger n = BigInteger.Parse(Console.ReadLine());
  10.         BigInteger factN = 1;
  11.         for (int i = 1; i <= n; i++)
  12.         {
  13.             factN *= i;
  14.         }
  15.         Console.WriteLine("Factorial is: {0}", factN);
  16.         Console.WriteLine("Number of zeros are {0}",n/5);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement