In this tutorial, we will discuss a concept of the Python program to find sum of two numbers using recursion
In this article, we are going to learn how to find the addition of two numbers using recursion in the Python programming language
Program
This program allows entering two digits to find the addition of two numbers using the recursive function in Python programming language
def sum(x,y): if(y==0): return x; else: return(1+sum(x,y-1)); x=int(input("Enter number first number: ")) y=int(input("Enter number second number: ")) print("Sum of two numbers are: ",sum(x,y))
When the above code is executed, it produces the following results
Enter number first number: 35 Enter number second number: 40 Sum of two numbers are: 75)
Method
Similar post
Python code to the sum of two numbers
Python program to sum of two numbers using the function
Python program sum of numbers in a list
Suggested for you
The operator in Python language
if statements in Python language
PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…
PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…
5 methods to add two numbers in Java In this tutorial, we will discuss the…
Python full Pyramid star pattern program In this tutorial, we will discuss the concept of…
Write a function or method to convert C into F -Entered by the user In…
How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…