Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- class Program
- {
- public static BigInteger CalculateCustomFactoriel(int x)
- {
- BigInteger result = 1;
- while (x > 0)
- {
- result *= x;
- x--;
- }
- return result;
- } // testing method
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int sumOfFives = 0;
- int powedFive = 1;
- int result;
- for (int i = 1; i < n; i++)
- {
- powedFive = (int)Math.Pow(5, i);
- result = n / powedFive;
- if (result > 1)
- {
- Console.WriteLine(result);
- sumOfFives += result;
- }
- else
- {
- break;
- }
- }
- Console.WriteLine(sumOfFives);
- Console.WriteLine(CalculateCustomFactoriel(n)); // for test
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement