Hi all !
This program calculates the power of a number using recursion.
if i set the initial value of ans(the local variable in the method power)
other than 1 , things get messed up why???
One other thing.
I'm using the following stmt
ans=base1*power(base1,power1-1);
But even if i use
ans*=base1*power(base1,power1-1);
I get same answer.
But i guess the best approach is to simply return the expresion
return base1*power(base1,power1-1);
Thanks in advance
--Danish
[ Jess added
UBB [code] tags to preserve whitespace ]
[ October 31, 2002: Message edited by: Jessica Sant ]