Interview Q&A / Aptitude

BeginnerQuick answer1 min readUpdated 3 Oct 2026

How many trailing zeros does 250! have?

SHORT ANSWER

62. Each trailing zero needs a pair of 2 and 5, and 5s are scarcer, so count the 5s: 250/5 = 50, 250/25 = 10, 250/125 = 2 (take whole parts), total 62.

Explain it simply

A zero at the end of a number comes from a factor of 10, which is 2 x 5. In 250! there are plenty of even numbers, so 2s are never the problem. The 5s are the bottleneck, like the number of complete cricket teams being limited by how many wicketkeepers you have. So the question becomes: how many 5s hide inside 1 x 2 x ... x 250?

Example

Question: Find the number of trailing zeros in 250!.

  1. Multiples of 5 up to 250: 250 / 5 = 50. Each gives at least one 5.
  2. Multiples of 25 give an extra 5: 250 / 25 = 10.
  3. Multiples of 125 give one more: 250 / 125 = 2.
  4. Multiples of 625: none.
  5. Total = 50 + 10 + 2 = 62.
js
let n = 250, zeros = 0;
for (let p = 5; p <= n; p *= 5) zeros += Math.floor(n / p);
console.log(zeros); // Output: 62

What to say in the interview

"Trailing zeros equal the number of 10s, and since 2s are more common than 5s I only count 5s. I divide by 5, 25, 125 and so on, keeping whole parts, and add. For 250 that is 50 + 10 + 2 = 62."

Common mistakes

  • Stopping after dividing by 5 and answering 50; 25 contains two 5s, 125 contains three.
  • Counting 2s instead of 5s.

#aptitude#number-system#factorial

Related questions

Practise more Aptitude questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Aptitude quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.