input and output function
Mostra commenti meno recenti
I have been trying to learn functions but must have a mental block. I am trying to take a number "n" as an input and output the sum of numbers up to "n" (Inclusive). For example, if input is 10, the program would output 55. I wrote the following.
function sum = sumNum(n)
end
I know I am missing something. Can some one help me. Thanks.
1 Commento
Divyang Jain
il 31 Mag 2019
U haven't given any statment inside function sum so u will not recieve any output so try giving a statment inside a loop and then try
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!