Consider the following recursive C function that takes two arguments.
unsigned int foo(unsigned int n, unsigned int r) { if (n>0) return ((n%r) + foo(n/r, r)); else return 0; }
What is the return value of the function $\text{foo}$ when it is called as $\text{foo(345, 10)}$?
Red colour represents return values.
Answer is 12.
Following recursive calls
β΄ 5+4+3+0 = 12