1: #include<stdio.h>
2: #include<conio.h>
3: #include<stdlib.h>
4: #include<math.h>
5: #define PIE 3.14
6:
7: void angles(float x,float y,float z, float *a1,float *a2,float *a3);
8: void main()
9: { 10: float a,b,c,A,B,C;
11: float p,q,r,P,Q,R;
12: printf("Enter the sides of ABC:\n"); 13: scanf("%f%f%f",&a,&b,&c); 14: printf("Enter the sides of PQR:\n"); 15: scanf("%f%f%f",&p,&q,&r); 16: angles(a,b,c,&A,&B,&C);
17: angles(p,q,r,&P,&Q,&R);
18: printf("Angle A= %.2f\n",A); 19: printf("Angle B= %.2f\n",B); 20: printf("Angle C= %.2f\n",C); 21: printf("Angle P= %.2f\n",P); 22: printf("Angle Q= %.2f\n",Q); 23: printf("Angle R= %.2f\n",R); 24: getch();
25: }
26: void angles(float x,float y,float z, float *a1,float *a2,float *a3)
27: { 28: *a1=(180.0/PIE)*acos((y*y+z*z-x*x)/(2.0*y*z));
29: *a2=(180.0/PIE)*acos((x*x+z*z-y*y)/(2.0*z*x));
30: *a3=(180.0/PIE)*acos((y*y+x*x-z*z)/(2.0*y*x));
31: }