Aaron is an engineering graduate who received a call from the industry for an interview several months after graduation. So he was practicing the recursion method and he wants to test his skills on numbers.

he found a set of numbers that has to be fed into a storage device where the sum of digits of numbers has to be found for memory management in the storage device.

So the task to find the sum of digits in a number using functions.

**Input:**
A Integer input represents “num”.
**Output:**
The sum of digits.

#include <stdio.h> int sum(int); int main() { int n; scanf("%d",&n); printf("%d",sum(n)); return 0; } int sum(int num) { int r,sum=0; while(num!=0){ r=num%10; sum+=r; num/=10; } return sum; }

**INPUT_1:**

12345

**OUTPUT:**

15

**INPUT_2:**

986754

**OUTPUT:**

39

**INPUT_3:**

56982

**OUTPUT:**

30

**INPUT_4:**

124421

**OUTPUT:**

14

**INPUT_5:**

11111

**OUTPUT:**

5

**INPUT_6:**

89998

**OUTPUT:**

43

**ILLUSTRATION**

**Morae Q!**

- Conversion of days into year, weeks and days.
- Find if the number is a perfect number or not.
- Compute conversion of Binary to Octal.
- Return the sum of digits in a number.
- Find if a word exists or not in a sentence.
- Convert Numbers into Words.
- Read a word if it consists only of the letters known.
- Check if the string is a dynamic string or not.
- Convert all Uppercase letters to Lowercase and vice-versa.
- Change the string such that there are no matching adjacent characters.
- Find the number of sub-strings which start and end both in 1.
- Find the start and end index of unsorted sub-array.
- Find the maximum number of pairs that can be formed.
- Figure out the number of bubbly words present.
- Check if a string is lapindrome or not even with a middle character.
- Seating layout in a triangular shaped class according to the number of rows.
- Find and Sort a sub-array which makes whole array sorted.
- Seating layout according to the number of rows.
- Find the final states of the bulbs.
- Check if reversing sub array makes the array sorted.