Data Structures & AlgorithmsHardGATE CS · TCS NQT

How many trailing zeros does 50! (50 factorial) have in decimal?

  1. A. 10
  2. B. 12
  3. C. 47
  4. D. 2

Correct answer: B. 12

Trailing zeros = exponent of 5 in 50! = ⌊50/5⌋ + ⌊50/25⌋ = 10 + 2 = 12. Using only ⌊n/5⌋ gives 10 (25 and 50 each hold two 5s), 2 is only the second term, and 47 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