Hi everyone,

Is there a way i can make these functions more efficient?

Code:int UlitmateCollapse (int num) { int ones, sum = 0; /* check if integer is one digit long */ if (digitcount(num) == 1) { return num; } /* sum up all digits in the double */ while (num != 0) { ones=num%10; num=num/10; sum = sum + ones; } return UlitmateCollapse(sum); } int digitcount (int num) { int count, ones =0; while (num != 0) { ones=num%10; num=num/10; count = count + 1; } return count; }