aboutsummaryrefslogtreecommitdiff
path: root/challenge-153
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-153')
-rw-r--r--challenge-153/robert-dicicco/tcl/ch-1.tcl24
1 files changed, 24 insertions, 0 deletions
diff --git a/challenge-153/robert-dicicco/tcl/ch-1.tcl b/challenge-153/robert-dicicco/tcl/ch-1.tcl
new file mode 100644
index 0000000000..4845ca19a1
--- /dev/null
+++ b/challenge-153/robert-dicicco/tcl/ch-1.tcl
@@ -0,0 +1,24 @@
+# Author: Robert DiCicco
+# Date: 21-FEB-2022
+# Challenge #153 Left Factorials ( Tcl )
+
+proc Factorial {x} {
+ set i 1; set product 1
+ while {$i <= $x} {
+ set product [expr $product * $i]
+ incr i
+ }
+
+ return $product
+}
+
+set Total 0
+set I 0
+
+while { $I < 10 } {
+ set X [Factorial $I]
+ set Total [expr $X + $Total]
+ puts -nonewline $Total
+ puts -nonewline " "
+ incr I
+}