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

In the previous article, we have discussed Python Program to Find Sum of Two Numbers using Recursion<\/a><\/p>\n

Given two numbers and the task is to find the subtraction 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      =  10\r\nGiven Second Number =   4<\/pre>\n

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

The subtraction of { 10 - 4 } using recursion = 6<\/pre>\n

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

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

Given First Number      = 35\r\nGiven Second Number = 12<\/pre>\n

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

The subtraction of { 35 - 12 } using recursion = 23<\/pre>\n

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

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