![]() |
Given a number, we need to find the sum of digits in the number using recursion. In C#, recursion is a process in which a function calls itself directly or indirectly and the corresponding function is known as a recursive function. It is used to solve problems easily like in this article using recursion we will find the sum of digits of a number. Example Input: 456 Output: 15 Input: 123 Output: 6 Approach:
Example 1: C#
Output
Sum = 6 Example 2: C#
Output: Hi! Enter the Number: 12345 The Sum of Digits is 15 |
Reffered: https://www.geeksforgeeks.org
C# |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 10 |