Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- class MainClass
- {
- static void Main()
- {
- BigInteger num = BigInteger.Parse(Console.ReadLine());
- BigInteger facturel = FactorialCalc(num);
- Console.WriteLine(CountZeros(facturel));
- }
- static BigInteger FactorialCalc(BigInteger num)
- {
- BigInteger sum = num;
- for (BigInteger i = num - 1 ; i >= 1; i--)
- {
- sum *= i;
- }
- return sum;
- }
- static BigInteger CountZeros(BigInteger facturel)
- {
- var counter = 0;
- while (facturel > 0)
- {
- var temp = facturel % 10;
- if (temp == 0)
- {
- counter++;
- }
- else
- {
- return counter;
- }
- facturel = facturel / 10;
- }
- return counter;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement