Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

int a[100]; unsigned long addDights(unsigned long num) { int n=0,sum=0; LOOP:for(;num>=1;n++) { a[n]=num%10; num/=10; sum+=a[n]; if(num==0&&sum>=10) { num=sum; sum=0; } } if(sum>=10) { goto LOOP; } return sum; }

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.