Ask your own question, for FREE!
Computer Science 18 Online
Gucchi:

Read the following code: # Calculate average average = num1 + num2 + num3 / 3.0 There is an error in the code. How should the code be revised in order to get the correct output? average = num1 + num2 + num3 - 3.0 average = num1 + num2 + num3 * 3.0 average = (num1 + num2 + num3) / 3.0 average = num1 + num2 + num3 / (3.0)

Gucchi:

@smokeybrown

Gucchi:

am i right with C?

SmokeyBrown:

Yup, you got it. You would want to put the additive variables in parentheses so they are all added together, and then divided by 3. That is how you would calculate the average. Well done :)

Gucchi:

thank you

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!