这是为什么??为学c,想编个幂函数,结果总是0.0000
为啥啊1 #include <stdio.h>
2 #include <math.h>
3
4 int main()
5 {
6 double x;
7 int y;
8 printf("x = ");
9 scanf("%lf/n", &x);
10 printf("y = ");
11 scanf("%d/n", &y);
12 printf("Power(x, y) = %lf\n", pw(x,y));
13 }
14
15 pw(double x, int y)
16 {
17 double s;
18 int t;
19 s=1.0;
20
21 for(t=1;t<=y;t++)
22 {
23 s*=x;
24 }
25
26 return s;
27 }