#include<stdio.h>
int power(int,int);
void main()
{
int n,p;
printf("Enter number>>
");
scanf("%d",&n);
printf("Enter power>>
");
scanf("%d",&p);
printf("\n\tPower\t%d",power(n,p));
}
int power(int n,int p)
{
int result=1;
while(p>0)
{
result=result*n;
p--;
}
return result;
}
No comments:
Post a Comment