{"id":20224,"date":"2021-09-09T19:57:33","date_gmt":"2021-09-09T14:27:33","guid":{"rendered":"https:\/\/python-programs.com\/?p=20224"},"modified":"2021-11-22T18:36:24","modified_gmt":"2021-11-22T13:06:24","slug":"python-program-to-find-sum-of-two-numbers-using-recursion","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-sum-of-two-numbers-using-recursion\/","title":{"rendered":"Python Program to Find Sum of Two Numbers using Recursion"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find the First Small Letter in a Given String<\/a><\/p>\n

Given two numbers and the task is to find the sum of the given two numbers using recursion.<\/p>\n

Recursion:<\/strong><\/p>\n

Recursion is the process by which a function calls itself directly or indirectly, and the associated function is known as a recursive function. Certain issues can be addressed fairly easily using a recursive approach. Towers of Hanoi (TOH), Inorder \/Preorder\/Postorder Tree Traversals, DFS of Graph, and other analogous issues are examples.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given First Number      =  3\r\nGiven Second Number =  0<\/pre>\n

Output:<\/strong><\/p>\n

The sum of { 3 } and { 0 } using recursion = 3<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given First Number      = 20\r\nGiven Second Number = 30<\/pre>\n

Output:<\/strong><\/p>\n

The sum of { 20 } and { 30 } using recursion = 50<\/pre>\n

Program to Find Sum of Two Numbers using Recursion in Python<\/h2>\n

Below are the ways to find the sum of the given two numbers using recursion :<\/p>\n