Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics; // Note that you must add reference to System.Numerics
- class TrailingZeroesInNFac
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- BigInteger factorial = 1;
- int trailingZeroes = 0;
- for (int i = 1; i <= n; i++)
- {
- factorial *= i;
- }
- while (factorial % 10 == 0)
- {
- trailingZeroes++;
- factorial /= 10;
- }
- Console.WriteLine("Trailing Zeroes: {0}", trailingZeroes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement