1.
clear all;close all;clc;commandwindow;
x=10;
if round(x/5)==x/5
x=(2*x)+4;
else
if x==10
x=4*x;
else
x=0;
end
end
disp(x);
2.
x=10;
if round(x/3)==x/3
x=(2*x)+4;
else
if x==10
x=4*x;
else
x=0;
end
end
disp(x);
3.
x=10;
if round(x/4)==x/4
x=(2*x)+4;
else
if x==10
x=4*x;
else
x=0;
end
end
disp(x);
4.
quantity=input('enter the number of giant slinkys you wish to
ship');
if quantity<0
display('Please enter a positive value');
else
flag=0;
if quantity<=10
cost=quantity*21.99;
end
if quantity>=11 && quantity<=50
cost=quantity*19.99;
end
if quantity>=51 && quantity<=100
cost=quantity*17.99;
end
if quantity>100
cost=quantity*15;
end
if quantity>=50
shipping_cost=0;
else
quantity=ceil(quantity/10);
shipping_cost=quantity*10;
end
cost=cost+((cost*9.5)/100)+shipping_cost; Â Â
display('total cost is:')
display(cost);
end