Question: Identify the error in the following segment of code. Assuming the user has declared and entered real values for price 1 , price 2 ,

Identify the error in the following segment of code. Assuming the user has declared and entered real values for price1, price2, quantity1, quantity2, the program is to calculate the total cost.
cost1= price1* quantity1
cost2= price2* quantity2
total cost = cost1+ cost2
In lines 1 and 2 the "*" should be changed to "+".
Line 3 uses incorrect variable name or names.
The "+" in line 2 should be changed to a "*".
Lines 1 and 2 uses incorrect variable name or names.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!