This topic contains a solution. Click here to go to the answer

Author Question: Analyze the following code.double sum = 0;for (double d = 0; d < 10; sum += sum + d) { d += 0.1;} (Read 121 times)

mp14

  • Hero Member
  • *****
  • Posts: 534
Analyze the following code.

double sum = 0;
for (double d = 0; d < 10; sum += sum + d) {
d += 0.1;
}

◦ The program has a syntax error because the control variable in the for loop cannot be of the double type.
◦ The program compiles but does not stop because d would always be less than 10.
◦ The program compiles and runs fine.
◦ The program has a syntax error because the adjustment statement is incorrect in the for loop.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by mp14 on May 6, 2020

lorealeza

  • Sr. Member
  • ****
  • Posts: 345
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 25% of students answer this correctly




mp14

  • Member
  • Posts: 534
Reply 2 on: May 6, 2020
Thanks for the timely response, appreciate it


ASDFGJLO

  • Member
  • Posts: 335
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

Not getting enough sleep can greatly weaken the immune system. Lack of sleep makes you more likely to catch a cold, or more difficult to fight off an infection.

Did you know?

The first oncogene was discovered in 1970 and was termed SRC (pronounced "SARK").

Did you know?

Though methadone is often used to treat dependency on other opioids, the drug itself can be abused. Crushing or snorting methadone can achieve the opiate "rush" desired by addicts. Improper use such as these can lead to a dangerous dependency on methadone. This drug now accounts for nearly one-third of opioid-related deaths.

Did you know?

It is believed that the Incas used anesthesia. Evidence supports the theory that shamans chewed cocoa leaves and drilled holes into the heads of patients (letting evil spirits escape), spitting into the wounds they made. The mixture of cocaine, saliva, and resin numbed the site enough to allow hours of drilling.

Did you know?

The first oral chemotherapy drug for colon cancer was approved by FDA in 2001.

For a complete list of videos, visit our video library