img
Question:
Published on: 21 November, 2024

Write the recursive algorithm to find x^ n.

Answer:
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);
    }
}

Random questions