Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- namespace TestGround
- {
- class Test
- {
- public static void Main(string[] args)
- {
- int number = int.Parse(Console.ReadLine());
- CalculateFactoriel(number);
- }
- private static void CalculateFactoriel(int number)
- {
- BigInteger result = number;
- for (int i = 1; i < number; i++)
- {
- result = result * i;
- }
- CauntZeroesInResult(result);
- }
- private static void CauntZeroesInResult(BigInteger result)
- {
- string resultStr = result.ToString();
- int countZeros = 0;
- int stringlenght = resultStr.Length;
- for (int i = 0; i < stringlenght; i++)
- {
- if (resultStr.EndsWith("0"))
- {
- countZeros++;
- resultStr = resultStr.Remove(resultStr.Length - 1);
- }
- else
- {
- Console.WriteLine(countZeros);
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement