#include
#include
int main(void)
{
double x=0,y=0;//初始化x,y
int n=0;//初始化n
printf("输入x的值:\n");
scanf("%f",&x);//输入x的值;
printf("输入n次方:\n");
scanf("%d",&n);//输入你想要的次方;
y=pow(x,n);//求x的n次方;
printf("X的n次方为:%f\n",y);//输出x的n次方结果;
return 0;
}
# include"stdAfx.h"
#include
int main(void)
{
int n,k,x, i,m;
printf("请输入正整数的个数:\n");
scanf("%d", &k);
while (k>0){
k--;
m = 1;
scanf("%d %d",&x,& n);
/*for (i = 1; i <= n; i++)
m = m*x;*/
m = pow((float)x, n);
printf("%d \n", m);
}
return 0;
}
#include
#include
int main()
{
…
pow(x,n);
…
}