SHARE
TWEET

18.ZeroCounter

vasko1926 Jan 13th, 2015 242 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top