ProgrammingVery hard

unsigned char s = 0; for (int i = 1; i <= 100; i++) s += i; printf("%d", s); What is printed?

  1. A. 186
  2. B. 5050
  3. C. 58
  4. D. 122

Correct answer: A. 186

The sum 5050 wraps modulo 256 on each addition into an unsigned char. 5050 mod 256 = 186.

More C Programming questions

Exams that ask this topic