diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-02-22 09:10:00 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-02-22 09:10:00 +0000 |
| commit | 0c43bedd1756a6ca1052fb4ee172d5384441b0da (patch) | |
| tree | f5c50506e83b10b972cc4757dd945890c5b9615a | |
| parent | b46f3826d4f7c8d66914f934e903fc906fac4dec (diff) | |
| download | perlweeklychallenge-club-0c43bedd1756a6ca1052fb4ee172d5384441b0da.tar.gz perlweeklychallenge-club-0c43bedd1756a6ca1052fb4ee172d5384441b0da.tar.bz2 perlweeklychallenge-club-0c43bedd1756a6ca1052fb4ee172d5384441b0da.zip | |
- Added more guest contribution by Robert DiCicco.
| -rw-r--r-- | challenge-153/robert-dicicco/tcl/ch-1.tcl | 24 |
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 +} |
