n term series using For loop

9 次查看(过去 30 天)
marie
marie 2013-3-13
n=input('enter a value n:');
s=0;
k=1;
for k=<n
s=s+k;
k=k+1;
end
I was trying to change my while loop for this one (for loop) to see if the results were the same but when i type the code it says unexpected matlab operator The code was working for the while loop

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-3-13

Gilles
Gilles 2013-3-13

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by