Question: Create a script ingredient _ cost . m that: Prompts the user to input the cost of each ingredient and the quantity required for a

Create a script ingredient_cost.m that:
Prompts the user to input the cost of each ingredient and the quantity required for a recipe.
Uses a while loop to allow the user to add as many ingredients as they like.
Outputs the total cost using fprintf in a formatted way.
Use a while loop that continues asking for more ingredients until the user indicates they are done.
Example interaction: > Enter the cost of the ingredient: 2.50>> Enter the quantity required: 3>> Would
you like to add another ingredient? (y/n): y

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!