Skip to content

Commit 62689b0

Browse files
authored
Create 172-factorial-trailing-zeroes.js
1 parent 3ade627 commit 62689b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

172-factorial-trailing-zeroes.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @param {number} n
3+
* @return {number}
4+
*/
5+
const trailingZeroes = function(n) {
6+
let result = 0;
7+
for(let i = 5; Math.floor(n/i) > 0; i *= 5){
8+
result += (Math.floor(n/i));
9+
}
10+
return result;
11+
};

0 commit comments

Comments
 (0)