编写C语言求反三角

来源:百度知道 编辑:UC知道 时间:2024/06/19 23:10:43
用C语言完整写出A+B=90°,sinA/sinB=n,求A,B角的过程

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
float ax,ay;
float x,y;
float n;
scanf("%f",&n);
ay=sqrt(1/(n*n+1));
ax=n*ay;
x=asin(ax);
y=asin(ay);
printf("%s%f,%s%f","A=",x/3.14*180,"B=",y/3.14*180);
return 0;
}

VC2008测试通过

//运行正常 运行正确
#include<stdio.h>
#define PI 3.14159
#include<math.h>
void main()
{
double A,B,n,a;
scanf("%lf",&n);

a=atan(n); //tan(a)=n

A=a/PI*180; //弧度转换成角度数
B=90-A;
printf("A=%.2f B=%.2f\n",A,B);
}