I have the loop as given below. But I need to restrict the value of b till 30, i.e. the value of b cannot exceed 30. 'a' value does not have a limit. I am not sure how to proceed.
a=0;
b=0;
g=a+b;
while g<100
a=a+1
b=b+1
g=a+b
end

 採用された回答

Birdman
Birdman 2018 年 1 月 29 日
編集済み: Birdman 2018 年 1 月 29 日

0 投票

a=0;
b=0;
g=a+b;
while g<100
if b<30
b=b+1
else
end
a=a+1
g=a+b
end

1 件のコメント

Busy Bee
Busy Bee 2018 年 1 月 29 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2018 年 1 月 29 日

コメント済み:

2018 年 1 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by