Skip to main content

Practice · 1 of 5

Factorial Trailing Zeros

CHALLENGE
Difficulty: beginner+25 XP

**Description:** Compute n! and count how many trailing zeros it has. 1 <= n <= 20 (20! fits in a 64-bit integer). **Input:** One line: n (1 <= n <= 20). **Output:** Line 1: n!. Line 2: the number of trailing zeros. **Example:** 10 -> 3628800 / 2.

Back to lesson: Practice: Recursion Problem Set