{"id":9571,"date":"2021-09-30T17:30:20","date_gmt":"2021-09-30T12:00:20","guid":{"rendered":"https:\/\/python-programs.com\/?p=9571"},"modified":"2021-11-22T18:33:32","modified_gmt":"2021-11-22T13:03:32","slug":"python-program-to-find-the-sum-of-the-digits-of-the-number-recursively","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-the-sum-of-the-digits-of-the-number-recursively\/","title":{"rendered":"Python Program to Find the Sum of the Digits of the Number Recursively"},"content":{"rendered":"

Are you wondering how to seek help from subject matter experts and learn the Java language? Go with these Basic Java Programming Examples<\/a> and try to code all of them on your own then check with the exact code provided by expert programmers.<\/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

Given a number the task is to calculate the sum of the digits of the given number using recursive approach in Python.<\/p>\n

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

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

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

Enter some random number = 18627677851<\/pre>\n

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

The total sum of digits off the given number 18627677851 = 58<\/pre>\n

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

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

Enter some random number = 7816833887102099<\/pre>\n

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

The total sum of digits off the given number 7816833887102099 = 80<\/pre>\n

Program to Find the Sum of the Digits of the Number Recursively<\/h2>\n

Below are the ways to calculate the sum of the digits of the given number using recursive approach in Python.<\/p>\n