Chapter:

Recursive-program-in-c

C Program to calculate a Number raised to Power of N using Recursion

Below is a program to calculate the result of a given number, raised to the power of n using recursion.

Source code:

#include<stdio.h>


// function prototype declaration

int power(int n1, int n2);


int main()

{

    int base, exp;

    printf("Enter base number: ");

    scanf("%d", &base);

    printf("\n\nEnter Power factor: ");

    scanf("%d", &exp);

    printf("\n\n\n\t\t\t%d^%d = %d", base, exp, power(base, exp));

     return 0;

}


int power(int b, int e)

{

    if(e == 0)

        return 1;


  &nbs....Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-