take m=8 and trace the Algorithm and verify the options A.3 B.64 C.2$\sqrt{2}$=2.82 D.3
Imp Note:-> we cant take variable type as int (cz it is an algorithm as specified in question) if U do so we end up with incorrect result
Now Trace the algorithm
Initially m=8 , $\epsilon$=1 , x=8 , y=1
Iteration # |
x |
y |
while(x - y >1) |
1 |
8 |
1 |
True |
2 |
4.5 |
1.78 |
True |
3 |
3.14 |
2.55 |
True |
4 |
2.85 |
2.8 |
False |
So it match with Option C .