Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Mutual-recursion/Tcl/mutual-recursion.tcl
Normal file
21
Task/Mutual-recursion/Tcl/mutual-recursion.tcl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
proc m {n} {
|
||||
if { $n == 0 } { expr 0; } else {
|
||||
expr {$n - [f [m [expr {$n-1}] ]]};
|
||||
}
|
||||
}
|
||||
proc f {n} {
|
||||
if { $n == 0 } { expr 1; } else {
|
||||
expr {$n - [m [f [expr {$n-1}] ]]};
|
||||
}
|
||||
}
|
||||
|
||||
for {set i 0} {$i < 20} {incr i} {
|
||||
puts -nonewline [f $i];
|
||||
puts -nonewline " ";
|
||||
}
|
||||
puts ""
|
||||
for {set i 0} {$i < 20} {incr i} {
|
||||
puts -nonewline [m $i];
|
||||
puts -nonewline " ";
|
||||
}
|
||||
puts ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue