rev='made'/> name='keywords'/> name='author'/> ANURANAN: UVa Solution 11332: Summing Digits

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 11332: Summing Digits

#include<stdio.h>
int main()
         {
long int n,sum;
while (scanf(“%lu”,&n)==1 && n!=0)
             {
                        if (n<10)
                        printf(“%lu\n”,n);
                       if (n>9)
             {
                     while (n>9)
                     {
                                 sum=0;
                                 while (n>0 )
                            {
                                sum=sum+n%10;
                                n=n/10;
                            }
                       n=sum;
                       }    printf(“%lu\n”,sum);
              }
       }
return 0;
}

No comments:

Post a Comment