Use a while loop to calculate f=10!. Display only the final value using the function "disp"

2 件のコメント

James Tursa
James Tursa 2021 年 2 月 20 日
What have you done so far? What specific problems are you having with your code?
Kate Heidingsfelder
Kate Heidingsfelder 2021 年 2 月 20 日
I figured it out! Thanks though!

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

 採用された回答

Kate Heidingsfelder
Kate Heidingsfelder 2021 年 2 月 20 日

0 投票

kk = 10;
k = 1;
f = 1;
while k <= kk
f = k * f;
k = k + 1;
end
format long
disp(f)

その他の回答 (2 件)

Anusha
Anusha 2023 年 10 月 25 日

0 投票

kk = 10;
k = 1;
f = 1;
while k <= kk
f = k * f;
k = k + 1;
end
format long
disp(f)
Anusha
Anusha 2023 年 10 月 25 日

0 投票

kk = 10;
k = 1;
f = 1;
while k <= kk
f = k * f;
k = k + 1;
end
format long
disp(f)

カテゴリ

ヘルプ センター および File Exchange で Communications Toolbox についてさらに検索

製品

リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by