حل السؤال الاول :-
ch=0
while ch~=4
clc
disp('*')
disp(' Geometry Calculator ')
disp('1-Calculate the Area of a Circle ')
disp('2-Calculate the Area of Rectangule ')
disp('3-Calculate the Area of a square ')
disp('4-Quit ')
disp(' ')
ch=input('Enter your choice :');
disp(' ')
disp('*')
disp(' ')
switch ch
case 1
r=input('Enter the radius : ');
a=pi*r^2;
disp(['the area of the circle is : ',num2str(a)])
z=input('press enter key ')
case 2
s=input('Enter the side : ');
l=input('Enter the length : ');
a=s*l;
disp(['the area of the rectangle is : ',num2str(a)])
z=input('press enter key ');
case 3
s=input('Enter the side : ');
a=s^2;
disp(['the area of the square is : ',num2str(a)])
z=input('press enter key ');
case 4
clc
end
end
============
حل السؤوال الثاني
n=input('Pls enter n : ');
s=0;
for k=0:n
s=s+((-1)^k*(1/(2*k+1)));
S(k+1)=s;
end
disp('The summation of the series is = ');disp(S);
y=pi/4;
k=0:n;
plot(k,y,k,S(k+1))
شوف المرفقات

دعواتك