ProgrammingVery hard

printf("%d", pow_mod(2, 100, 1000000007)); where pow_mod is standard binary exponentiation with 64-bit intermediates. What is printed?

  1. A. 976371285
  2. B. 976371284
  3. C. 1024
  4. D. 2147483647

Correct answer: A. 976371285

2^100 mod (10^9 + 7) = 976371285, which a correct square-and-multiply loop produces.

More C Programming questions

Exams that ask this topic