vs2019为什么答案错误啊??

img

sin函数的参数要求是弧度,你输入的x可能是角度,需要换算一下
s = sin(x/180*3.1415926);

试试写为scanf_s("%lf",&x,1);这种形式,明确输入参数数量
有帮助望采纳~

你是不是没保留小数位 例如输出时用%.2lf可以控制保留两位

#include <stdio.h>
#include <math.h>
int main()
{
    double x,s;
    printf("input a number:\n");
    scanf("%lf",&x);
    s=sin(x*3.14/180);
    printf("sine of %lf is %.2lf\n",x,s);
   return 0;

}


img

#include <bits/stdc++.h>
int main()
{
double x,s;
printf("input a number:\n");
scanf("%lf",&x);
s=sin(x*3.14/180);
printf("sine of %lf is %.2lf\n",x,s);
return 0;

}

你看这个行不行