I have written the following code.

Given two sides and an angle, calculate the third side and the remaining two angles in the triangle. Then output if it is right, obtuse or acute.

My problem is that it will only output information if I input 90 for the initial angle. What am I doing wrong?

Code:

#include <stdio.h>#include <math.h>
#define PI 3.14159265358979323846
long double input_a(void);
long double input_b(void);
long double input_A(void);
long double calc_c(long double a,long double b,long double A);
long double calc_B(long double b,long double c,long double A);
long double calc_C(long double c,long double a,long double A);
int main(void)
{
long double A, B, C, a, b, c;
a=input_a();
b=input_b();
A=input_A();
if (A==90)
{
c= calc_c(a, b, A);
B= calc_B(b, c, A);
C= calc_C(c, a, A);
}
else
{
c= calc_c(a, b, A);
B= calc_B(b, c, A);
C= calc_C(c, a, A);
}
if(A<90 && B<90 && C<90)
{
printf("This is an acute triangle");
}
else if(A==90 || B==90 || C==90)
{
printf("This is a right triangle");
}
else
{
printf("This is an obtuse triangle");
}
getch();
}
long double input_a()
{
long double a;
printf("Enter the length of the first side of the triangle\n");
scanf("%lf", &a);
return a;
}
long double input_b()
{
long double b;
printf("Enter the length of the second side of the triangle\n");
scanf("%lf", &b);
return b;
}
long double input_A()
{
long double A;
printf("Enter the angle A (degrees) between the two sides\n");
scanf("%lf", &A);
return A;
}
long double calc_c(long double a,long double b, long double A)
{
long double c;
c = sqrt((a*a) + (b*b)) - 2 * a * b * cos (A * PI/180);
printf("The length of the third side is %lf\n", c);
return c;
}
long double calc_B(long double b,long double c,long double A)
{
long double B;
B= asin(b*sin(A * PI/180)/c);
printf("Angle B is %lf (radians)\n", B);
B= 180*B/PI;
printf("Angle B is %lf (degrees)\n", B);
return B;
}
long double calc_C(long double c,long double a,long double A)
{
long double C;
C= asin(a*sin(A * PI/180)/c);
printf("Angle C is %lf (radians)\n", C);
C= 180*C/PI;
printf("Angle C is %lf (degrees)\n", C);
return C;
}