June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
40
Task/Anonymous-recursion/Ring/anonymous-recursion.ring
Normal file
40
Task/Anonymous-recursion/Ring/anonymous-recursion.ring
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Project : Anonymous recursion
|
||||
# Date : 2018/01/03
|
||||
# Author : Gal Zsolt (~ CalmoSoft ~)
|
||||
# Email : <calmosoft@gmail.com>
|
||||
|
||||
t=0
|
||||
for x = -2 to 12
|
||||
n = x
|
||||
recursion()
|
||||
if x > -1
|
||||
see t + nl
|
||||
ok
|
||||
next
|
||||
|
||||
func recursion()
|
||||
nold1=1
|
||||
nold2=0
|
||||
if n < 0
|
||||
see "positive argument required!" + nl
|
||||
return
|
||||
ok
|
||||
if n=0
|
||||
t=nold2
|
||||
return t
|
||||
ok
|
||||
if n=1
|
||||
t=nold1
|
||||
return t
|
||||
ok
|
||||
while n
|
||||
t=nold2+nold1
|
||||
if n>2
|
||||
n=n-1
|
||||
nold2=nold1
|
||||
nold1=t
|
||||
loop
|
||||
ok
|
||||
return t
|
||||
end
|
||||
return t
|
||||
Loading…
Add table
Add a link
Reference in a new issue