Home » C Programming » Functions

What will be the output of the program? #include int sumdig(int); int main() { int a, b; a = sumdig(123); b = sumdig(123); printf("%d, %d\n", a, b); return 0; } int sumdig(int n) { int s, d; if(n!=0) { d = n%10; n = n/10; s = d+sumdig(n); } else return 0; return s; }

Correct Answer: 6, 6

← Previous Question Next Question→

More Questions from Functions

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion