fixed factorial exercises
This commit is contained in:
parent
9fbf7653b1
commit
bd055b12e5
@ -1 +1 @@
|
|||||||
printfaculty(5);
|
printfactorial(5);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function x = mufactorial(n)
|
function x = myfactorial(n)
|
||||||
% return the factorial of n
|
% return the factorial of n
|
||||||
x = 1;
|
x = 1;
|
||||||
for i = 1:n
|
for i = 1:n
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function printfaculty(n)
|
function printfactorial(n)
|
||||||
% compute the faculty of n and print it
|
% compute the factorial of n and print it
|
||||||
x = 1;
|
x = 1;
|
||||||
for i = 1:n
|
for i = 1:n
|
||||||
x = x * i;
|
x = x * i;
|
||||||
|
Reference in New Issue
Block a user