Welcome Message

Hi, welcome to my website. This is a place where you can get all the questions, puzzles, algorithms asked in interviews and their solutions. Feel free to contact me if you have any queries / suggestions and please leave your valuable comments.. Thanks for visiting -Pragya.

December 29, 2009

Program to find nth power of a given number

public static long findPower(long x , long pow){
if(pow == 1){
return x;
}else if(pow == 0){
return 1;
}else {
return x*findPower(x, --pow);
}
}

No comments: