RosettaCodeData/Task/Factorial/Tcl/factorial-1.tcl
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

6 lines
128 B
Tcl

proc ifact n {
for {set i $n; set sum 1} {$i >= 2} {incr i -1} {
set sum [expr {$sum * $i}]
}
return $sum
}