How can a teacher answer this ?
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Write a program that will display the result of n! using a loop. For example, if the user enters 5 for n, the program should display “factorial of is 120”.
1 Kommentar
Thomas Nguyen
am 8 Apr. 2018
function[] = factorial()
n=input('Enter value n: ');
fac=1;
for i=1:n
fac=fac*i;
end
disp(['The factorial of ',num2str(n),' is: ',num2str(fac)])
end%factorial()
Antworten (0)
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!