int main(int argc, char* argv[]) { int n1, sum; printf(" Recursion : Find the sum of digits of a number :"); printf("-----------------------------------------------------"); printf(" Input any number to find sum of digits: "); scanf("%d", &n1);
sum = digit_sum(n1);//call the function for calculation
printf(" The Sum of digits of %d = %d", n1, sum);
return 0; } int digit_sum(int n1) { if(n1 == 0) return 0; return ( 1 ) // do not forget the comma