Question: bill=18; tip; if bill <10 tip=1.80; end elseif (bill>=10 & bill 60) tip=0.20*bill end fprintf('The amount of the tip is $' ,tip) Am trying to

bill=18;

tip;

if bill<10

tip=1.80;

end

elseif (bill>=10 & bill<=60)

tip=0.18*bill;

end

elseif (bill>60)

tip=0.20*bill

end

fprintf('The amount of the tip is $' ,tip)

Am trying to write a code for MATLAB to print out the tip in a restaurant but it keeps giving errors including illegal use of reserved keyword 'elseif'

If the bill is less than $10, the tip is $1.80.

If the bill is between $10 and $60, the tip is 18% of the bill.

If the bill is larger than $60, the tip is 20% of the bill.

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!