0

What are the constraints on the argument values of these two methods, and explain what the method does.

int power( int base, int exponent)
{
if (exponent == 0)
    return 1;
else
    return (base * power(base, exponent -1));
}

int factorial (int n)
{
if (n > 0)
    return (n * factorial (n-1));
else
if (n == 0)
    return 1;
}
4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by stultuske
0

It's your homework. Do some google and you should find the exact answers... Also, this is for you to think, not for you to ask for answers. <snip>

PS: The format of the code is in C/C++. It is not Java.

Edited by JamesCherrill: Please avoid language that could give offense.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.