/**************************************************/
if and while loop in matlab
%table %
i=1;
x=input('Enter any number\n');
if(x<10)
while i<11
z=x*i;
fprintf('%d*%d=%d\n',x,i,z);
i=i+1;
end
end
for loop
%table %
i=1;
x=input('Enter any number\n');
if(x<10)
for i=1:1:10
z=x*i;
fprintf('%d*%d=%d\n',x,i,z);
end
end
0 comments:
Post a Comment