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에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!