永发信息网

关于codeblocks中的c语言编程题问题

答案:1  悬赏:80  手机版
解决时间 2021-05-16 17:53
  • 提问者网友:藍了天白赴美
  • 2021-05-16 12:59

题目是求(1+sin0.1)*(1+sin0.2)....(1+sinx)

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{float a,b,c;
a=0.1;
c=1;
printf("please enter the b\n");
scanf ("%f",&b);
while(a<=b)
{
a=a+0.1;
c*=(1+sin(a));
}
printf("the key is %f",&c);
return 0;
}
不知道为什么我输入后出来的答案一直是0.000000是不是不能用sin计算请高人赐教

最佳答案
  • 五星知识达人网友:轮獄道
  • 2021-05-16 14:28

printf("the key is %f",&c);错了。


应该把“&”删掉,改成printf("the key is %f",c);就对了。

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯