RosettaCodeData/Task/Mutual-recursion/BASIC256/mutual-recursion.basic
2023-07-01 13:44:08 -04:00

20 lines
488 B
Text

# Rosetta Code problem: http://rosettacode.org/wiki/Mutual_recursion
# by Jjuanhdez, 06/2022
n = 24
print "n : ";
for i = 0 to n : print ljust(i, 3); : next i
print chr(10); ("-" * 78)
print "F : ";
for i = 0 to n : print ljust(F(i), 3); : next i
print chr(10); "M : ";
for i = 0 to n : print ljust(M(i), 3); : next i
end
function F(n)
if n = 0 then return 0 else return n - M(F(n-1))
end function
function M(n)
if n = 0 then return 0 else return n - F(M(n-1))
end function