#include
#include
#include
void main()
{
int n,s=0;
clrscr();
printf(“
enter a number:”);
scanf(“%d”, &n);
printf(“
Sum of digits till a single digit
%d”, n);
for(;n=0;)
{
s=s+n%10;
n=n/10;
if(n= =0) &&s>9)
{
Printf(“
%2d”, s);
N=s;
S=0;
}
}
printf(“
%2d”,s);
getch();
}
Output:
Enter a number:4687
Sum of digits till a single digit
4687
25
7