Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

How many trailing zeros does 25! have?

  1. A. 22
  2. B. 6
  3. C. 5
  4. D. 1

Correct answer: B. 6

Trailing zeros count factors of 5: ⌊25/5⌋ + ⌊25/25⌋ = 5 + 1 = 6. Counting only multiples of 5 gives 5 (25 holds two 5s), 1 is just the second term, and 22 is the exponent of 2, which is never the limit.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic