diff options
Diffstat (limited to '662/CH7/EX7.5/ex7_5.sce')
-rwxr-xr-x | 662/CH7/EX7.5/ex7_5.sce | 12 |
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
|