C Program to add the digits of number until result is in single number:
Here we will see that how to add the all digits of an given number until result is become in single digit.
In which we calculate the sum of all digits in the number.
For Example:
lets take an integer number which is 456. now we will find the generic root of this number is 4 + 5 + 6 = 15. since there is result become in two digits. then we again add the both digits 1 + 5 = 6.
so, the generic root of the given number(456) is 6.
ALGORITHM:-

step 1 : Start
step 2 : Input any integer number from user
step 3 : Now we add the all digits of the given number
step 4 : If the result become is more then one digits
step 5 : Then we again add the digits
step 6 : Print the generic root
step 7 : Stop

PROGRAM CODE:-

#include<stdio.h>
#include<conio.h>

void main()
{
    long int num,sum,r;
    printf("\nEnter a number:-");
    scanf("%ld",&num);

    while(num>10)
    {
        sum=0;
        while(num)
        {
            r=num%10;
            num=num/10;
            sum+=r;
        }
        if(sum>10)
        {
            num=sum;
        }
        else
        {
            break;
        }
    }
    printf("\nSum of the digits in single digit is: %ld",sum);
    getch();
}


OUTPUT:-

Enter any number: 456

Sum of the degits in single digit is: 6

C Program to add the all digits of the number until it become in singl digit
How to add the all digits of an number
Sum of all digits until single digits