Advertisement
Mary_99

ex1.5

Nov 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5.     float a; //a i b are legs
  6.     float b;
  7.     float c; //c = hypotenuse
  8.     printf("a = ");
  9.     scanf("%f", &a);
  10.     printf("b = ");
  11.     scanf("%f", &b);
  12.     c = (sqrt(pow(a,2)+pow(b,2))); //hypotenuse
  13.     printf("%f\n", c);
  14.  
  15.  
  16.     float alfa = acos(a/c)*180/M_PI;
  17.     float beta = acos(b/c)*180/M_PI;
  18.  
  19.     printf("%f\n", alfa);
  20.     printf("%f\n", beta);
  21.     if (alfa + beta == 90)
  22.     {
  23.         printf("\nJest okay");
  24.     }
  25.     else
  26.     {
  27.         printf("Nie jest OKEJ\n");
  28.     }
  29.  
  30.   return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement