public static int function(int n, int a, int b){(adsbygoogle = window.adsbygoogle || []).push({});

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?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Converting a recursion to a loop

**Physics Forums | Science Articles, Homework Help, Discussion**