Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Mutual-recursion/Seed7/mutual-recursion.seed7
Normal file
39
Task/Mutual-recursion/Seed7/mutual-recursion.seed7
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func integer: m (in integer: n) is forward;
|
||||
|
||||
const func integer: f (in integer: n) is func
|
||||
result
|
||||
var integer: res is 0;
|
||||
begin
|
||||
if n = 0 then
|
||||
res := 1;
|
||||
else
|
||||
res := n - m(f(n - 1));
|
||||
end if;
|
||||
end func;
|
||||
|
||||
const func integer: m (in integer: n) is func
|
||||
result
|
||||
var integer: res is 0;
|
||||
begin
|
||||
if n = 0 then
|
||||
res := 0;
|
||||
else
|
||||
res := n - f(m(n - 1));
|
||||
end if;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var integer: i is 0;
|
||||
begin
|
||||
for i range 0 to 19 do
|
||||
write(f(i) lpad 3);
|
||||
end for;
|
||||
writeln;
|
||||
for i range 0 to 19 do
|
||||
write(m(i) lpad 3);
|
||||
end for;
|
||||
writeln;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue