The Gateway to Computer Science Excellence
0 votes
249 views

int main()
{
float sum, i = 1.0, j = 2.0;
while (i/j > 0.0625)
{
j = j + j;
printf("%f", i+j);
}
}

The number of times printf statement is executed is:

in Programming by (243 points) | 249 views
+1
5 times
0
I think i=2 and j=1
0
As far as current program snippet is concerned , it will be 3.

But in gate 2019 , the values were swapped.

1 Answer

0 votes
According to the above example, the loop will run 5 times as the values of i/j is 0.5, 0.25, 0.125 and 0.0625

respectively. But in the actual GATE 2019 question the values were swapped and according to that, the loop will run 3 times.
by (95 points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,373 answers
198,513 comments
105,289 users