ProgrammingVery hard

long long r = 1; for (int i = 0; i < 40; i++) r = r * 2 % 1000000007; printf("%lld", r); What is printed (2^40 mod 10^9 + 7)?

  1. A. 511620083
  2. B. 511620084
  3. C. 1099511627776
  4. D. 0

Correct answer: A. 511620083

After 40 doublings with reduction, the value equals 2^40 mod 1000000007, which is 511620083.

More C Programming questions

Exams that ask this topic