summaryrefslogtreecommitdiff
path: root/662/CH7/EX7.5/ex7_5.sce
diff options
context:
space:
mode:
Diffstat (limited to '662/CH7/EX7.5/ex7_5.sce')
-rwxr-xr-x662/CH7/EX7.5/ex7_5.sce12
1 files changed, 12 insertions, 0 deletions
diff --git a/662/CH7/EX7.5/ex7_5.sce b/662/CH7/EX7.5/ex7_5.sce
new file mode 100755
index 000000000..4e68ecf07
--- /dev/null
+++ b/662/CH7/EX7.5/ex7_5.sce
@@ -0,0 +1,12 @@
+ //Example 7.5
+//factorial calculation
+
+function[prod] = Factorial(n) //factorial is a reserve word
+ prod=1;
+ if n >1 then
+ for i = 2 :1: n
+ prod=prod*i;
+ end
+ end
+ return prod;
+endfunction