Q:

Write a recursive function to calculate the sum of numbers from 0 to 10

0

Write a recursive function to calculate the sum of numbers from 0 to 10

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def calculateSum(num):
    if num:
        return num + calculateSum(num-1)
    else:
        return 0

res = calculateSum(10)
print(res)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now