Advertisement
vasko1926

18.ZeroCounter

Jan 13th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.41 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         long num = long.Parse(Console.ReadLine());
  8.         long zeroSum = 0;
  9.         long k = 1;
  10.  
  11.         while (Math.Pow(5, k) < num)
  12.         {
  13.             long powResult = (long)Math.Pow((double)5, k);
  14.             zeroSum += num / powResult;
  15.             k++;
  16.         }
  17.         Console.WriteLine("Number of zeros: {0}", zeroSum);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement