Advertisement
fqrmix

Laba 2 | 15 var

Oct 14th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #define pi 3.14
  4. int main(void){
  5.     float a = 0, b = 0, fi, r;
  6.     scanf_s("%f %f", &a, &b);
  7.     r = sqrt(a + b);
  8.     if (a == 0 && b == 0)
  9.         fi = 0;
  10.     else if (a > 0 && b >= 0)
  11.         fi = atan(a / b);
  12.     else if (a == 0 && b > 0)
  13.         fi = pi / 2;
  14.     else if (a < 0)
  15.         fi = pi + atan(a / b);
  16.     else if (a == 0 && b < 0)
  17.         fi = 3 * pi / 2;
  18.     else if (a > 0 && b < 0)
  19.         fi = 2 * pi + atan(a / b);
  20.     printf("r = %f\nfi = %f", r, fi);
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement