楼上那个只是把 1到100显示出来....
这样就可以啦
sum = 0;
for i =1:100
sum = sum + i
end
想要高级点,可以用fprintf显示
sum = 0;
for i =1:100
sum = sum + i;
fprintf('sum to %d gives %d\n',i,sum);
end
for cnt=1:100
disp(cnt);
end
clear all
t=0;
for i=1:100
t=t+i
end