Write the recursive algorithm to find x^ n.

Added 2 years ago
Active
Viewed 1399
Ans
float  power(float x, int n)
{
    if(x=0)
    {
         return 0;
    }
    else if(n==0)
    {
         return 1;
    }
    if(n>0)
    {
         return x * power(x,n-1);
    }
}



Related Questions