c语言输入一个度,计算三角函数sin和cos的值的代码
时间: 2023-05-15 19:04:42 浏览: 348
计算三角函数的C源码
3星 · 编辑精心推荐
#include <stdio.h>
#include <math.h>
int main() {
double degree, radian, sin_value, cos_value;
printf("请输入一个角度:");
scanf("%lf", °ree);
radian = degree * M_PI / 180.0;
sin_value = sin(radian);
cos_value = cos(radian);
printf("sin(%lf) = %lf\n", degree, sin_value);
printf("cos(%lf) = %lf\n", degree, cos_value);
return 0;
}
阅读全文