Write a program to allow the following interactive session
Solution
% matlab code
year = input(\"Enter year: \");
 month = input(\"Enter month: \");
 day = input(\"Enter day: \");
 price = double(input(\"Enter gas price per gallon in dollars: \"));
 amount = input(\"Enter amount of gas in gallons: \");
total = amount*price;
 fprintf(\"On %d/%d/%d the price of gas was $%0.3f.\ Thus, %d gallons of gas is $%0.3f.\ \",day, month, year, price, amount, total);
%{
 output:
Enter year: 2015
 Enter month: 9
 Enter day: 23
 Enter gas price per gallon in dollars: 2.348
 Enter amount of gas in gallons: 10
 On 23/9/2015 the price of gas was $2.348.
 Thus, 10 gallons of gas is $23.480.
 Enter year: 2014
 Enter month: 6
 Enter day: 23
 Enter gas price per gallon in dollars: 3.456
 Enter amount of gas in gallons: 20
 On 23/6/2014 the price of gas was $3.456.
 Thus, 20 gallons of gas is $69.120.
%}

