Recursive Power Calc
Power , x to the power y which means y number of times x must be multiplied to obtains the value of x to the power y.We use recursive function. Recursive function means a function calling itself.
/*
http://www.ProbCOMP.com
Power , x to the power y which means y number of times x must be multiplied to obtains the value of x to the power y.
We use recursive function. Recursive function means a function calling itself.
*/
#include<stdio.h>
int calc_power(int number,int power)
{
if(power==1)
return number;
else
number=number*calc_power(number,power-1);
return number;
}
void main()
{
printf("%d",calc_power(4,2));
}
Download Program


