GATEverse
← GATE CSE 2004

Q32

MCQ2 marks, −0.5

Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n=d1 d2 … dmn = d_1\, d_2\, \ldots\, d_m. int n, rev; rev = 0; while(n > 0) { rev = rev * 10 + n%10; n = n/10; } The loop invariant condition at the end of the ithi^{th} iteration is:

Sign in to save attempts.

Loading…