为了账号安全,请及时绑定邮箱和手机立即绑定

谁能帮我找出其中的问题? 反三角函数 应该怎么写?

谁能帮我找出其中的问题? 反三角函数 应该怎么写?

C
慕侠2389804 2023-04-22 17:13:33
#include<stdio.h> #include<math.h> int main() { double a;a=sin(45);printf("f%",a);}为什么不能显示45度角的对边比斜边??显示的是f
查看完整描述

2 回答

?
陪伴而非守候

TA贡献1757条经验 获得超8个赞

要用弧度计算的,另外,pintf语句中,应该是"%lf",不是"f%"

sin()是三角函数,参数使用的是弧度,不是度。

asin()才是反三角函数。

资料 :

NAME
asin, asinf, asinl - arc sine function

SYNOPSIS
#include <math.h>

double asin(double x);
float asinf(float x);
long double asinl(long double x);

Link with -lm.

DESCRIPTION
The asin() function calculates the arc sine of x; that is the value
whose sine is x. If x falls outside the range -1 to 1, asin() fails
and errno is set.

RETURN VALUE
The asin() function returns the arc sine in radians and the value is
mathematically defined to be between -PI/2 and PI/2 (inclusive). 

查看完整回答
反对 回复 2023-04-25
?
江户川乱折腾

TA贡献1851条经验 获得超5个赞

帮你更正一下:
int main() 

const double pi=3.14; //定义pi的值
double a; 
a=sin(45*pi/180); //角度转化为弧度
printf("%f",a); //printf的正确格式
}

查看完整回答
反对 回复 2023-04-25
  • 2 回答
  • 0 关注
  • 98 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信