Jan
17
#include<conio.h>
#include<stdio.h>
int power(int,int);
void main(){
int x,n,result;
printf(“Enter number : “);
scanf(“%d”,&x);
printf(“Enter power : “);
scanf(“%d”,&n);
result=power(x,n);
printf(“Power is: %d”,result);
}
int power(int x,int n){
if (n==1)
return x;
else
return (x*power(x,n-1));
}
Leave a Reply
No Comments