Question: In matlab, I am writing a code that asks a user how many pens they want to buy. pens= input('How many pens are you buying?')

In matlab, I am writing a code that asks a user how many pens they want to buy.
pens= input('How many pens are you buying?')
Pens can be blue, black, or red, which respectively cost $1, $2, and $3. I want to write a loop that asks for the color of each pen the user is buying so I can calculate the total cost of the pens. How would I do this?

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 Databases Questions!