Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Factorial Problems involving repeition

조회 수: 1 (최근 30일)
hBk
hBk 2013년 9월 17일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello, i have a little and maybe simple problem here..can somebody help me to solve my problem.. i appreciate it.. How to write a matlab code for factorial problem. for example;
E= 1!+2!+3!+....... until the calculation stops at 153. The program also gives/display how many times it has to do the addition until it get to 153.
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 17일
What have you tried so far?

답변 (1개)

Yatin
Yatin 2013년 10월 16일
편집: Yatin 2013년 10월 16일
Hi,
Below is the code. The value of " count " is the number of times the sum was carried out.
addition = 0;
count = 0;
oldFact = 1;
while(addition < 153)
newFact = (count+1)*oldFact;
addition = addition + newFact;
oldFact = newFact;
count = count+1;
end

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by