ProgrammingHard

For positive values below 2^31, which product is guaranteed to fit in a signed 64-bit integer?

  1. A. (10^9 + 6) x (10^9 + 6)
  2. B. (10^10) x (10^10)
  3. C. (2^32) x (2^32)
  4. D. (10^12) x (10^12)

Correct answer: A. (10^9 + 6) x (10^9 + 6)

(10^9 + 6)^2 is about 10^18, below 9.2 x 10^18 for signed 64-bit. The other products exceed 2^63.

More C Programming questions

Exams that ask this topic