You are on page 1of 1

/*A program to raise the power of x to power n*/

#include<stdio.h>
int power(int x,int n)
{
if(n==0)
{
return 1;
}
else
{
return (x*power(x,n-1));
}
}
int main()
{
int x,n,result;
printf("Enter a Value of x & n:");
scanf("%d%d",&x,&n);
result=power(x,n);
printf("The power of x to power n is %d",result);
return 0;
}

You might also like