rev='made'/> name='keywords'/> name='author'/> ANURANAN: UVa Solution 10018: Reverse and Add

Welcome Note

Hi,
I'm Anisuzzaman Babla . I am a full stack Android Application Developer. I am working with Android for more than two years. I have completed my graduation from IIT, Jahangirnagar University. I have developed a series of commercially successful apps on Android. Moreover, 10+ of my Apps are live at Google play store. .
Thank You

UVa Solution 10018: Reverse and Add

#include <cstdio>
int main()
{
    int kase;
    long long int n,c,sum,r,d;
    scanf("%d",&kase);
    while (kase--)
    {
        scanf("%lld",&n);
        d=n;
        c=0;
        while (1)
        {
            sum=0;
            while (d>0)
            {
                r=d%10;
                sum=sum*10+r;
                d=d/10;
            }
            if (n==sum)
                break;
            else
            {
                d=sum+n;
                n=sum+n;
                c++;
            }
        }
        printf("%lld %lld\n",c,n);
    }
    return 0;
}