Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shohan4556/c4e4726ecea54855af94 to your computer and use it in GitHub Desktop.
Save shohan4556/c4e4726ecea54855af94 to your computer and use it in GitHub Desktop.
UVA 11332 (summing digit ) solution in C
///Author : Shohanur Rahaman
//Problem level : Easy
//UVA : 11332 (Summing Digits)
#include <stdio.h>
int main()
{
int t;
long long int n;
while(scanf("%lld",&n)==1){
if(n==0)
break;
t=0;
while(1){
while(n!=0){
t=t+(n%10);
n=n/10;
}
if(t/10==0)
break;
else{
n=t;
t=0;
}
}
printf("%d\n",t);
}
return 0;
}
@dabananda-zz
Copy link

Thank you so much sir. This solution is so easy to understand.

@shohan4556
Copy link
Author

Thank you so much sir. This solution is so easy to understand.

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment