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

1 回表示 (過去 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'?
  1 件のコメント
Hiro Yoshino
Hiro Yoshino 2023 年 3 月 7 日
Why don't you run the code on MATLAB?

サインインしてコメントする。

採用された回答

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro 2023 年 3 月 7 日
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 Center および File ExchangeLoops 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