convert for loop to while

조회 수: 2 (최근 30일)
Mohammed Bokhow
Mohammed Bokhow 2020년 4월 7일
편집: darova 2020년 4월 7일
how can i convert this
n=5;fact = 1 ;
for i = 1:n
fact =fact * i;
end;
disp(fact)
into while loop
with my best regards

채택된 답변

KSSV
KSSV 2020년 4월 7일
편집: darova 2020년 4월 7일
i = 1 ;
f = 1 ;
n = 3 ;
while i<=n
f=f*i;
i = i+1 ;
end
  댓글 수: 6
KSSV
KSSV 2020년 4월 7일
I gave you the answer.......you need to change the variables accoridng to yours thats it...
Mohammed Bokhow
Mohammed Bokhow 2020년 4월 7일
ok how can i change them i'm bignner at using matlab

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by