# Question

(R@H) #1

محتاجة أعرف حل ال4 مسائل دول حالا اذا أمكن

(Ahmed) #2
``````clc;clear all;close all;

consumptions=[200 500 700 1000 1500];
[m n]=size(consumptions);
Fee=5;

for i=1:n
if consumptions(i) <= 500
TheCost=0.02*consumptions(i);
elseif consumptions(i) <= 1000
TheCost=10+0.05*(consumptions(i)-500);
else
TheCost=35+0.1*(consumptions(i)-1000);
end
TotalCost=TheCost+Fee;
disp(TotalCost)
end
``````
``````clc;clear all;close all;
deposite=50;
balance=0;
for months=1:12
Total=balance+deposite;
interest=0.01*Total;
balance=Total+interest;
mydisp(months,1)=months;
mydisp(months,2)=balance;
end
disp('-----MONTH---BALANCE')
disp(mydisp)
``````
``````clc;clear all;close all;

xo=0;
yo=0;
X(1)=0;
Y(1)=0.21;

k=2:500; % << we start from "2" because we have the value of xo,yo,x1,y1

for i=k
X(i)=(Y(i-1))*(1+sin(0.7*(X(i-1))))-1.2*(sqrt(abs(X(i-1))));
Y(i)=0.21-X(i-1);
end
plot(Y,X,'.')
``````
``````clc;clear all;close all;

Balance = 1000;

for years = 1 : 10
for months = 1 : 12
Balance = Balance * 1.01;
end
disp( [years Balance] );
end
``````