/* Program to find sum of digits of a 5 digit number, with recursion */ /* Problem 12 (b) */ #include #include int fun(long n) { static int sum; sum = 0; if (n >= 10) return sum + (n % 10) + fun(n / 10); else return n; } main() { long num; clrscr(); printf("Please enter a 5 digit number : "); scanf("%ld",&num); printf("\nThe sum of digits of the number %ld is %d",num,fun(num)); printf("\n\nPress any key to exit..."); getch(); }