8 votes 8 votes 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 4 8 9 6720 Programming in C isro2015 programming-in-c loop + – go_editor asked Jun 21, 2016 • edited Dec 9, 2022 by Lakshman Bhaiya go_editor 7.7k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 12 votes 12 votes i=6720, j=4 while ((6720) % 4 ==0) i = 6720/4 = 1680 j= 4 + 1 = 5 while ( (1680 ) % 5 ==0) i= 1680 / 5 =336 j = 5 + 1 = 6 while ( (336) %6 ==0) i= 336 / 6 =56 j = 6+1 = 7 while ((56 %7) ==0) i = 56/7 = 8 j= 7+1=8 while((8%8==0) i= 8/8 = 1 j = 8+1 = 9 while ( 1 % 9 ==0) // false Ans - j = 9 vijaycs answered Jun 21, 2016 • selected Jun 26, 2016 by Anu vijaycs comment Share Follow See all 0 reply Please log in or register to add a comment.
7 votes 7 votes 6720/4 = 1680 ===> j=5 1680/5 = 336 ===> j=6 336/6 = 56 ===> j=7 56/7 = 8 ===> j=8 8/8 = 1 ===> j=9 Hence final value of j = 9 Kapil answered Jun 21, 2016 Kapil comment Share Follow See all 0 reply Please log in or register to add a comment.