How many lines of output does the following C code produce?\n```c\n#include <stdio.h>\nfloat i = 2.0;\nfloat j = 1.0; \nfloat sum = 0.0;\nmain()\n{ \n while (i/j > 0.001) \n {\n j = j + j;\n sum = sum + (i/j);\n printf("%f\n", sum);\n }\n}\n```
- A. 8
- B. 9
- C. 10
- D. 11
Answer: D. 11
Explanation: Initial: i=2, j=1. Ratio 2.\nLoop 1: j=2. Ratio 1. Print.\nLoop 2: j=4. Ratio 0.5. Print.\n...\nCondition $i/j > 0.001 \Rightarrow 2/j > 0.001 \Rightarrow j < 2000$.\nj takes values: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048.\nLoop runs for j = 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024.\nAt j=2048, ratio is 0.0009 < 0.001. Stop?\nWait. $j$ is updated inside. \nStart: 2/1 > 0.001 (True). j=2. Print. (1)\n... j=1024. Ratio 2/1024 approx 0.002 > 0.001. True. j=2048. Print. (11?)\nWait. Values of j entering loop: 1.\nValues of j used in print: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048.\nCheck loop condition with OLD j or NEW j? `while` checks before. \nBefore j=2048, j was 1024. 2/1024 > 0.001? 0.00195 > 0.001. Yes. Enters.\nj becomes 2048. Prints.\nNext check: 2/2048 = 0.00097 < 0.001. False. Loop ends.\nTotal prints: Powers $2^1$ to $2^{11}$. Total 11 lines.