Data Structures & AlgorithmsModerateTCS NQT Digital · Accenture

Problem: What is the last non-zero decimal digit of 10! (3628800)?

  1. A. 0
  2. B. 3
  3. C. 2
  4. D. 8

Correct answer: D. 8

3628800 without its trailing zeros is 36288, which ends in 8. Reading the raw last digit gives 0, 3 is the leading digit, and removing the factors of 5 without their matching 2s gives 10!/25 = 145152, ending in 2.

More Coding Interview Problems questions

Exams that ask this topic