Sum of its Individual Digits Repeatedly - MAKAUT / WBUT MCA 2011
18-12-2019    150 times

### Write a program to accept a number and find sum of its individual digits repeatedly till the result is a single digit. [MAKAUT / WBUT MCA 2011]

Here we use two loop, one for sum the digits and another one use for checkthat sum result.

#include <stdio.h>
int main()
{
int no,s=10;
printf("Enter A No : ");
scanf("%d",&no);
while(s>9)
{
s=0;
while(no>0)
{
s += no%10;
no /= 10;
}
no=s;
}
printf("One Digit Sum is %d",s);
}


Output :

Enter A No :2345
One Digit Sum is 5