ProgrammingVery hardCompetitive coding (CP)

What is printed? Assume uint32t is 32 bits.

What is printed? Assume uint32_t is 32 bits.
#include <stdint.h>
#include <stdio.h>
int main(void) {
    uint32_t a = 70000, b = 70000;
    uint32_t p = a * b;
    printf("%d", a != 0 && p / a != b);
}
  1. A. 0
  2. B. 2
  3. C. 1
  4. D. 3

Correct answer: C. 1

The product wraps to 605032704, and dividing back gives 8643, which is not 70000. The division test therefore reports overflow.

More C Programming questions

Exams that ask this topic