Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

ISRO | ISRO CS 2015 | Question 70

  • Last Updated : 05 Apr, 2018

Consider the following program fragment

i=6720; j=4;
while (i%j)==0
{
i=i/j;
j=j+1;
}

On termination j will have the value
(A) 4
(B) 8
(C) 9
(D) 6720


Answer: (C)

Explanation: Initially i= 6720, j=4

condition check (i%j==0)    i               j

6720 % 4 == 0, true         6720/4=1680     5
1680 % 5 == 0, true         1680/5=336      6
336 % 6 == 0, true          336/6=56        7
56 % 7 == 0, true           56/7=8          8
8 % 8 == 0, true            8/8=1           9
1 % 9 == 0, false, condition terminated

Option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :