float exp1(float p,int q);
#include<stdio.h>
main()
{
float x,k;
int n;
printf("enter x and n");
scanf("%f%d",&x,&n);
k=exp1(x,n);
printf("exp(%f,%d)=%f",x,n,k);
}
float exp1(float p,int q)
{
float t=1;
int i;
for(i=1; i<=q; i++)
{
t=t*p;
}
return t;
}
Note: Need to be arranged in compiler after copied
OutPut:
enter x and n
3 4
exp(3.000000,4)=81.000000