展开全部
#include<stdio.h>
int main(void)
{
double power(double x, double y);
double x, y;
printf("请输入底数后按回车\n");
scanf("%lf", &x);
printf("请输入指数后按回车\n");
scanf("%lf", &y);
printf("%lf的%lf次方是%lf", x, y, power(x, y));
return 0;
}
double power(double x, double y)
{
double a, b ,c=x;
for( a = 1; a < y; a++)
{
b = x;
c = c*b;
}
return c;
}
int main(void)
{
double power(double x, double y);
double x, y;
printf("请输入底数后按回车\n");
scanf("%lf", &x);
printf("请输入指数后按回车\n");
scanf("%lf", &y);
printf("%lf的%lf次方是%lf", x, y, power(x, y));
return 0;
}
double power(double x, double y)
{
double a, b ,c=x;
for( a = 1; a < y; a++)
{
b = x;
c = c*b;
}
return c;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询