Skip to content

Commit 0413736

Browse files
Fix
Signed-off-by: begeekmyfriend <begeekmyfriend@gmail.com>
1 parent d5a9a9c commit 0413736

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

172_factorial_trailing_zeros/zeroes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
static int trailingZeroes(int n)
55
{
6-
return n == 0 ? 0 : trailingZeroes(n / 5);
6+
/* As 10 = 2 * 5 so we just count how many fives in it */
7+
return n == 0 ? 0 : n / 5 + trailingZeroes(n / 5);
78
}
89

910
int main(int argc, char **argv)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy