Commit 41d63650 by BellCodeEditor

auto save

parent 7c25cfae
Showing with 16 additions and 7 deletions
def func(num):
if num == 1:
# def func(num):
# if num == 1:
# return 1
# sum = func(num-1)
# a = num + sum
# return a
# print(func(5))
def func(n):
if n<=2:
return 1
sum = func(num-1)
a = num + sum
return a
print(func(5))
\ No newline at end of file
elif n > 2:
value = func(n-1)+func(n-2)
return value
result = func(50)
print(result)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment