using For loop function to find the sum of the number

조회 수: 1 (최근 30일)
Joseph
Joseph 2022년 2월 8일
댓글: Stephen23 2022년 2월 8일
I want to know how to solve this problem

답변 (1개)

Voss
Voss 2022년 2월 8일
Well, if the question were how to find the sum of the even numbers between 2 and 102, inclusive, using a for loop, you could say:
total = 0;
for ii = 2:2:102
total = total+ii;
end
Maybe you can use the same approach for the actual question.

카테고리

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