mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-11-22 08:33:48 +01:00
16 lines
275 B
C#
16 lines
275 B
C#
using System;
|
|
|
|
public static class Kata
|
|
{
|
|
public static int TrailingZeros(int n)
|
|
{
|
|
var sum = 0.0;
|
|
var max = Math.Floor(Math.Log(n)/Math.Log(5));
|
|
|
|
for (var i = 1; i <= max; i++) {
|
|
sum += Math.Floor(n / Math.Pow(5, i));
|
|
}
|
|
|
|
return (int) sum;
|
|
}
|
|
}
|