Trying to get an answer for 'a' - while loop??

조회 수: 3 (최근 30일)
Aleksandar Denchev
Aleksandar Denchev 2023년 3월 7일
편집: John D'Errico 2023년 3월 7일
a=0
while a<5
a = a + 2;
end
disp (a)
What is the answer for 'a'?

채택된 답변

Constantino Carlos Reyes-Aldasoro
Run the code!
a=0
a = 0
while a<5
a = a + 2;
end
disp (a)
6
  댓글 수: 1
John D'Errico
John D'Errico 2023년 3월 7일
편집: John D'Errico 2023년 3월 7일
Please, when something is this obviously a homework assignment, please do not just give the student the code to do their homework. It does not help the student. It does not help the site, as it just encourages this student to ask their homework questions with absolutely no effort made on their part. And that encourages other students to do the same.
If you want to offer some help to the student, try pushing them in the right direction. But make them do the work, as otherwise, they will just keep on posting their homework.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by