注册 登录
编程论坛 C语言论坛

萌新求助,这是哪里错了吗?还是我电脑有问题

fukangwei 发布于 2020-10-31 13:02, 1560 次点击
程序代码:
#include <stdio.h>
#include <math.h>
main ()
{
      double x,s;
      printf("Please input value of x: ");
      scanf ("%1f",&x);
      s=cos(x);
      printf("cos(%1f)=%1f\n",x,s);
}


这是运行结果:
Please input value of x: 0
cos(-92559592117431994000000000000000000000000000000000000000000000.000000)=0.986254
Press any key to continue
3 回复
#2
rjsp2020-10-31 20:03
1 和  l 不分?
#3
风过无痕19892020-11-01 09:14
回复 楼主 fukangwei
程序代码:

#include <stdio.h>
#include <math.h>
#define PI 3.1415927
int main ()
{
      double x,s;
      printf("Please input value of x: n");
      scanf ("%lf",&x);     // 没有下面一语句时,应输入弧度
      x = PI * x / 180;     // 加上此语句,输入的 x 是角度
      s = cos(x);
      printf("cos(%lf)=%1f\n",x,s);
}
#4
fukangwei2020-11-01 18:45
回复 2楼 rjsp
谢谢大哥
1