Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
15
Task/Left-factorials/Tcl/left-factorials.tcl
Normal file
15
Task/Left-factorials/Tcl/left-factorials.tcl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
proc leftfact {n} {
|
||||
set s 0
|
||||
for {set i [set f 1]} {$i <= $n} {incr i} {
|
||||
incr s $f
|
||||
set f [expr {$f * $i}]
|
||||
}
|
||||
return $s
|
||||
}
|
||||
|
||||
for {set i 0} {$i <= 110} {incr i [expr {$i>9?10:1}]} {
|
||||
puts "!$i = [leftfact $i]"
|
||||
}
|
||||
for {set i 1000} {$i <= 10000} {incr i 1000} {
|
||||
puts "!$i has [string length [leftfact $i]] digits"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue