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

The program has a syntax error because the semicolons in the for loop are in the wrong place.

The program has a syntax error because the control variable in the for loop cannot be double.

c. The program compiles but does not stop because d would always be less than 10.

d. The program compiles and runs fine.

5
Contributors
7
Replies
27
Views
2 Years
Discussion Span
Last Post by Priyanka_9
0

and what is your actual question?
even if you want to find out the hard way, all you need to do is copy paste the code, compile it and run it.

0

Hi thanks for the replay my question is which is the right answer of the following.

a. The program has a syntax error because the semicolons in the for loop are in the wrong place.

b. The program has a syntax error because the control variable in the for loop cannot be double.

c. The program compiles but does not stop because d would always be less than 10.

d. The program compiles and runs fine.

0

Repeating the question just wastes everyone's time. Read stultusk's answer, then simply try the code on your nearest computer. When you have done that, if you don't understand what happened, come back here for help.

0

Sounds like someone is trying to get answers for their homework because they were too lazy to pay attention in class.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.