How can I use conditional operators to improve my code?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, i'm new to Matlab and I was wondering if someone could help me find the fault in my code. I've written the script below, and my code is posted below that. My issue is that my integer values in the command window display horizontally rather than vertically even after i've transposed it. I'm not concerned with the sum of the 4 factorials portion of the script just yet. Thanks!
This is what i'm trying to accomplish:
For N<12, generate a script that displays n!, n = 1,2,.....,N and the sum of these factorials as shown for N = 4.
Enter an integer < 12: 4
For n = 1, 1! = 1
For n = 2, 2! = 2
For n = 3, 3! = 6
For n = 4, 4! = 24
The sum of these 4 factorials = 33
Where the value of 4 was enetered by the user.

0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Entering Commands in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!