필터 지우기
필터 지우기

While loop for factorial

조회 수: 4 (최근 30일)
Javier Torrecilla Toledo
Javier Torrecilla Toledo 2020년 6월 13일
댓글: Javier Torrecilla Toledo 2020년 6월 13일
I have been told to obtain the factorial of 13 using a while loop, and the solution given is the attached one. I don´t really understand why it's used that code, and would appreciate if someone could give me some explanations about it. Thanks!!
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 6월 13일
Use breakpoint, run the code line by line, and check the values of variables at each step. You will clearly see what is happening.
Javier Torrecilla Toledo
Javier Torrecilla Toledo 2020년 6월 13일
Thank you so much for much answer! It has been very helpful!

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

답변 (1개)

kumar Atishay
kumar Atishay 2020년 6월 13일
Point your mouse cursor to number 5 (5th line of your code) ,click on that then you will see a red circle appears on that point.Now run the code onece more ,you will see a arrow appears on that circle along with that you will see that run command in editor window is changed ,click on the "step" option which means your code will run step by step.After every click follow the arrow and the value of facto and counter in workspace window.You will definitely able to get your code.
  댓글 수: 1
Javier Torrecilla Toledo
Javier Torrecilla Toledo 2020년 6월 13일
Thank you very much for spending your time on helping me! I have just starte dwith Matlab and it's very nice getting such a good and fast help!

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

카테고리

Help CenterFile Exchange에서 Variables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by