Recursive 2

int x(int a, int b) {

if (b==0) {

return 1;

} else {

return a*(x*(a, b-1));

} }

In this code, if a=16 and b=4, what does the program return?


The answer is 65536.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Natsir Muhammad
May 27, 2015

sorry sir, i think the correct syntax is (for else{...}) return a*(x(a, b-1));

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...