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
Get step-by-step solutions from verified subject matter experts
