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

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

void main()
{
    int n,r;
    clrscr();
    cout<<"Enter any integer number, n = ";
    cin>>n;

    while(n>9)
    {
       r=0;
       while(n>0)
       {
          r=r+n%10;
          n=n/10;
       }
       n=r;
    }
   
    cout<<"Digital root = "<<n;

    getch();
}

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