/*编写一个程序计算 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;
}
黄迪明3.6
最新推荐文章于 2016-02-11 14:07:39 发布