Magic Number

Magic Number is a number whose eventual sum of digits is equal to 1.

Example 1: 19. 1+9 = 10. 1+0 = 1. Hence it is a Magic Number.

C
#include <stdio.h>
int main()
{
    int n=0,s=0,r=0,nCopy=0;
    printf("Enter a number: ");
    scanf("%d",&n);
    s=n;
    nCopy=n;
    while(s>9)
    {
        s=0;
        while(n>0)
        {
            r=n%10;
            s=s+r;
            n=n/10;
        }
        n=s;
    }
    if(s==1)
    {
        printf("%d is a Magic Number",nCopy);
    }
    else
    {
        printf("%d is not a Magic Number",nCopy);
    }
    return 0;
}
C