Question: Analyze the following code. double sum = 0; for (double d = 0; d < 10; sum += sum + d) { d += 0.1;
Analyze the following code. double sum = 0; for (double d = 0; d < 10; sum += sum + d) { d += 0.1; }
| Select correct awnser A.The program compiles and runs fine. | ||
| B.The program compiles but does not stop because d would always be less than 10. | ||
| C.The program has a syntax error because the adjustment statement is incorrect in the for loop. | ||
| D.The program has a syntax error because the control variable in the for loop cannot be of the double type. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
