Commit f2289e9e by BellCodeEditor

save project

parent 8a487f29
Showing with 9 additions and 0 deletions
def sum_numbers(num): def sum_numbers(num):
if num == 1:
return 1
result = num + sum_numbers(num-1)
return result
number = 50
res = sum_numbers(number)
print("1到"+str(number)+"和是:"+str(res))
\ 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