program to find the value of powers of x , x to the power some thing through c
#include<stdio.h>
int po(int x,int n)
{
if(n==0)
return(1);
if(n==1)
return(x);
if(n>0)
return(x*po(x,n-1));
}
int main()
{
int x,n,p;
printf("Enter the values of x and n:");
scanf("%d%d",&x,&n);
p=po(x,n);
printf("The result is:%d",p);
return(0);
}
#include<stdio.h>
int po(int x,int n)
{
if(n==0)
return(1);
if(n==1)
return(x);
if(n>0)
return(x*po(x,n-1));
}
int main()
{
int x,n,p;
printf("Enter the values of x and n:");
scanf("%d%d",&x,&n);
p=po(x,n);
printf("The result is:%d",p);
return(0);
}
Post a Comment