1: #include<stdio.h>
2: #include<conio.h>
3: #include<math.h>
4:
5: float getdegree(float radians)
6: {
7: float degree;
8: float pie=3.14159;
9: degree=(radians*180)/pie;
10: return(degree);
11: }
12:
13: float getangle(float x,float y, float z)
14: {
15: float rads;
16: float degs;
17: rads=(y*y+z*z-x*x)/(2.0*y*z);
18: rads=acos(rads);
19: degs=getdegree(rads);
20: return(degs);
21: }
22: void main()
23: {
24: float a,b,c,A,B,C;
25: printf("Enter the sides of the triangel: ");
26: scanf("%f%f%f",&a,&b,&c);
27: A=getangle(a,b,c);
28: printf("Angle A=%f degrees\n",A);
29: B=getangle(b,a,c);
30: printf("Angle B=%f degrees\n",B);
31: C=getangle(c,a,b);
32: printf("Angle C=%f degrees\n",C);
33: getch();
34: }
No comments:
Post a Comment