A Program That Read Any Integer & Display Its Digital Root.

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

void main()
{
    int n,r;
    clrscr();
    printf("Enter any integer number, n = ");
    scanf("%d",&n);

    while(n>9)
    {
       r=0;
       while(n>0)
       {
          r=r+n%10;
          n=n/10;
       }
       n=r;
    }
   
    printf("Digital root = %d",n);

    getch();
}

///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........