using the while loop function
古いコメントを表示
I am new to MATLAB and trying to use a while function and not understanding why there is no error, but keeps the system busy with no result.
function fac=fact(n);
fac=1;
while n>0
fac=fac*n;
n-1;
end
採用された回答
その他の回答 (1 件)
Akshay Kanoria
2013 年 10 月 7 日
1 投票
Hi, Inside the loop you should use n = n-1, it should solve your problem.
カテゴリ
ヘルプ センター および 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!