- #1
japplepie
- 93
- 0
public static int function(int n, int a, int b){
if (n>0){
if(b==0)
return a;
else
return function(n-1,a,function(n,a,b-1));
}
return b;
}
I have a recursive function of this form, how do I convert it to a loop?
if (n>0){
if(b==0)
return a;
else
return function(n-1,a,function(n,a,b-1));
}
return b;
}
I have a recursive function of this form, how do I convert it to a loop?