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

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

burton19126

  • Hero Member
  • *****
  • Posts: 532

Question 1

What is the value in count after the following loop is executed?

int count = 0;
do {
System.out.println("Welcome to Java");
} while (count++ < 9);
System.out.println(count);

◦ 8
◦ 9
◦ 10
◦ 11
◦ 0

Question 2

Analyze the following statement:

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

◦ The program runs in an infinite loop because d<10 would always be true.
◦ The program compiles and runs fine.
◦ The program has a compile error because the adjustment is missing in the for loop.
◦ The program has a compile error because the control variable in the for loop cannot be of the double type.


Related Topics

Need homework help now?

Ask unlimited questions for free

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

ecabral0

  • Sr. Member
  • ****
  • Posts: 310
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




burton19126

  • Member
  • Posts: 532
Reply 2 on: May 6, 2020
YES! Correct, THANKS for helping me on my review


okolip

  • Member
  • Posts: 362
Reply 3 on: Yesterday
Gracias!

 

Did you know?

There are 20 feet of blood vessels in each square inch of human skin.

Did you know?

Warfarin was developed as a consequence of the study of a strange bleeding disorder that suddenly occurred in cattle on the northern prairies of the United States in the early 1900s.

Did you know?

About 3.2 billion people, nearly half the world population, are at risk for malaria. In 2015, there are about 214 million malaria cases and an estimated 438,000 malaria deaths.

Did you know?

In the United States, there is a birth every 8 seconds, according to the U.S. Census Bureau's Population Clock.

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