Gas_Price - cost = g*amt; fprintf('Your cost will be...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% This program will calculate the price of gas. clc % Defined Variables Gas = input('Do you Want gas in Liters or Gallons?. Enter in sigle qoutes. ') switch Gas case 'gallons' g = input('Enter the amount of gas? ')
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cost = g*amt; fprintf('Your cost will be %1.2f',cost) case 'Liters' l = input('Enter the amount of gas? ') cost = g*(amt*3.7854); fprintf('Your cost will be %1.2f',cost) otherwise('Your ga end...
View Full Document

Ask a homework question - tutors are online