#include <stdio.h> int main() { int n,ans; while (scanf("%d",&n) && n!=0) { ans=0; while (n) { ans+=(n%10); n=n/10; } while (ans>9) { ans=(ans/10)+(ans%10); } printf("%d\n",ans); } return 0; }
Sunday, April 24, 2016

Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment