01-factorial-by-reference.mps is been added
This commit is contained in:
parent
15f7af48c2
commit
1befed4ba1
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/mumps
|
||||
|
||||
write "Enter n: "
|
||||
read n
|
||||
write n,"! = "
|
||||
do factorial(.n)
|
||||
write n,!
|
||||
halt
|
||||
|
||||
factorial(n)
|
||||
if n=1 quit
|
||||
set k=1
|
||||
for i=1:1:n do
|
||||
. set k=k*i
|
||||
set n=k
|
||||
quit
|
Loading…
Reference in New Issue