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

#include<stdio.h> 
#include<math.h> 
int main() 

double a;
a=sin(45);
printf("f%",a);
}为什么不能显示45度角的对边比斜边??显示的是f

慕侠2389804
浏览 105回答 2
2回答

陪伴而非守候

要用弧度计算的,另外,pintf语句中,应该是"%lf",不是"f%"sin()是三角函数,参数使用的是弧度,不是度。asin()才是反三角函数。资料 :NAMEasin, asinf, asinl - arc sine functionSYNOPSIS#include <math.h>double asin(double x);float asinf(float x);long double asinl(long double x);Link with -lm.DESCRIPTIONThe asin() function calculates the arc sine of x; that is the valuewhose sine is x. If x falls outside the range -1 to 1, asin() failsand errno is set.RETURN VALUEThe asin() function returns the arc sine in radians and the value ismathematically defined to be between -PI/2 and PI/2 (inclusive).&nbsp;

江户川乱折腾

帮你更正一下:int main()&nbsp;{&nbsp;const double pi=3.14; //定义pi的值double a;&nbsp;a=sin(45*pi/180); //角度转化为弧度printf("%f",a); //printf的正确格式}
打开App,查看更多内容
随时随地看视频慕课网APP