Data Update
This commit is contained in:
parent
015c2add84
commit
e50b5c3114
206 changed files with 6337 additions and 523 deletions
38
Task/Mutual-recursion/FutureBasic/mutual-recursion.basic
Normal file
38
Task/Mutual-recursion/FutureBasic/mutual-recursion.basic
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
def fn F( n as long ) as long
|
||||
def fn M( n as long ) as long
|
||||
|
||||
local fn F( n as long ) as long
|
||||
long result
|
||||
|
||||
if n == 0 then exit fn = 1
|
||||
result = n - fn M( fn F( n-1 ) )
|
||||
end fn = result
|
||||
|
||||
local fn M( n as long ) as long
|
||||
long result
|
||||
|
||||
if n == 0 then exit fn = 0
|
||||
result = n - fn F( fn M( n-1 ) )
|
||||
end fn = result
|
||||
|
||||
long i, counter
|
||||
|
||||
counter = 0
|
||||
for i = 0 to 19
|
||||
printf @"%3ld\b", fn F( i )
|
||||
counter++
|
||||
if counter mod 5 == 0 then print : counter = 0
|
||||
next
|
||||
|
||||
print : print
|
||||
|
||||
counter = 0
|
||||
for i = 0 to 19
|
||||
printf @"%3ld\b", fn M( i )
|
||||
counter++
|
||||
if counter mod 5 == 0 then print : counter = 0
|
||||
next
|
||||
|
||||
NSLog( @"%@", fn WindowPrintViewString( 1 ) )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue