Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Factorial Problems involving repeition

2 Ansichten (letzte 30 Tage)
hBk
hBk am 17 Sep. 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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 Kommentar
Azzi Abdelmalek
Azzi Abdelmalek am 17 Sep. 2013
What have you tried so far?

Antworten (1)

Yatin
Yatin am 16 Okt. 2013
Bearbeitet: Yatin am 16 Okt. 2013
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

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by