您的位置:首页 > 其它

黄迪明3.6

2016-02-11 13:55 204 查看
/*编写一个程序计算 x^y,其中 x 是浮点数, y 是正整数。*/

#include<stdio.h>
#include<stdlib.h>

int main()
{
int y;
double x;
int i;
double answer = 1;

printf("Please input x and y:");
scanf("%lf %d", &x, &y);

for (i = 1; i <= y; i++)
answer*=x;
printf("answer is %lf\n", answer);

system("pause");
return 0;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: