Python Program to Add Two Numbers using Recursion
Write Python Program to Add Two Numbers using Recursion
# Write Python Program to Add Two Numbers using Recursion def add_numbers(m, n): result = 0 if (m == 0): result = n else: result = 1 + add_numbers(n, m - 1) return result m = 15 n = 6 Sum = add_numbers(m, n) print(f'{m} + {n} = {Sum}')
Output:
15 + 6 = 21