Advertisement
milislavski

TrailingZeroInN

Apr 15th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. using System;
  2.  
  3. class TrailingZeroInN
  4. {
  5. static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. int zeroCounter = 0;
  9. int divider = 5;
  10. while (n / divider >= 1)
  11. {
  12. zeroCounter += n / divider;
  13. divider *= 5;
  14. }
  15. Console.WriteLine(zeroCounter);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement