repeat function and calculation
8 ビュー (過去 30 日間)
古いコメントを表示
here is my code
x=('input x')
y=x^+2
how do I ask once I get my output if I want the calculation to be repeated again
2 件のコメント
回答 (1 件)
Ameer Hamza
2020 年 3 月 8 日
This is a general structure of what you are trying to do
condition = true;
while condition
x = input('Enter a number: ');
y = x.^2;
disp(y);
condition = input("Do you want to continue? (yes/no)\n", 's') == "yes";
end
0 件のコメント
参考
カテゴリ
Help Center および 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!