edited by
5,673 views

3 Answers

Best answer
13 votes
13 votes

Answer is 11

initial condition j = 1 and i =2

i/j>0.001 ..... j should be >2000

now j increases as 2

So 2n > 2000 i.e 2048

therefor n = 11

for n = 12.... i/j<0.001 so condition false and exits loop

selected by
1 votes
1 votes
Its very simple maths used here

i/j > 0.001 holds true

As you can see i=2 always and never changes , while the value of j is constantly changing in terms of 2^n.

2/2^n > 0.001

1/2^(n-1) > 0.001

2^(n-1) < 1000 holds true

it will fail when 2^(n-1)=1024 ,

hence n-1=10

n=11
0 votes
0 votes
Answer is D
Answer:

Related questions

8 votes
8 votes
7 answers
1
0 votes
0 votes
1 answer
2
TusharKumar asked Dec 22, 2022
524 views
can anyone explain how the for loop works here..?
3 votes
3 votes
2 answers
3
4 votes
4 votes
1 answer
4