MCQ · 2 marks · C Programming

GATE CS 2017 CS-2 — Q37

Consider the C program fragment below which is meant to divide xx by yy using repeated subtractions. The variables x,y,qx, y, q and rr are all unsigned int.
while (r >= y) {
    r = r - y;
    q = q + 1;
}
Which of the following conditions on the variables x,y,qx, y, q and rr before the execution of the fragment will ensure that the loop terminates in a state satisfying the condition x == (y*q + r)?
Select one option