Title: Help
Retorna 1:

func é chamado 2 vezes, mas a não é incrementado

Luis Gustavo Giordano wrote:
003601c1c4ad$f3f090a0$[EMAIL PROTECTED]"> href="file://C:\WINDOWS\>
Alguém sabe qual o valor retornado da seguinte função:
 
public int func (int a, int b)
{
    if (b == 1)
        return a;
    else
        return a + func (a, b - 1)
}
 
Assumam valores de a = 1 e b = 2. Se possível, expliquem como vcs conseguiram chegar a alguma solução.

-- 
"'You guys (at Microsoft) still don't get it,' 
because it's sort of Java with reliability, productivity and security deleted."

					James Gosling

Responder a