n term series using For loop
이전 댓글 표시
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
댓글 수: 1
Matt J
2013년 3월 13일
In the for loop version, you would remove this line
k=k+1;
답변 (2개)
Azzi Abdelmalek
2013년 3월 13일
It's
for k=1:n
Gilles
2013년 3월 13일
0 개 추천
Check this link:
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!