clc
clear all
n=input(‘Enter a number = ‘);
if (n>0) && (n<5)
out=n*2;
disp(out)
elseif (n>=5)
out=n*3;
disp(out)
elseif (n<=0)
out=n;
disp(out)
end
2
clc
clear all
n1=input(‘Enter a number 1 = ‘);
n2=input(‘Enter a number 2 = ‘);
n3=input(‘Enter a number 3 = ‘);
n4=input(‘Enter a number 4 = ‘);
out=(n1+n1+n3+n4)./4;
disp(out)
clc
clear all
Sum_zoj =0;
Sum_fard=0;
for i=1:100
if mod(i,2)==1
Sum_zoj=i+ Sum_zoj;
elseif mod(i,2)==0
Sum_fard=i+ Sum_fard;
end
end
disp(‘Majmoe Adad Zojh beyn 1 ta 100’)
disp(Sum_zoj)
disp(‘Majmoe Adad Fard beyn 1 ta 100’)
disp(Sum_fard)
4
clc
clear all
x=input(‘Enter a number = ‘);
sum=0;
i=1;
while (i<=(x-1))
if rem(x,i)==0
i
sum =sum+i;
end
i=i+1;
end
if (x==sum)
disp(‘Kamel’)
else
disp(‘No kamel’)
end