Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #define pi 3.14
- int main(void){
- float a = 0, b = 0, fi, r;
- scanf_s("%f %f", &a, &b);
- r = sqrt(a + b);
- if (a == 0 && b == 0)
- fi = 0;
- else if (a > 0 && b >= 0)
- fi = atan(a / b);
- else if (a == 0 && b > 0)
- fi = pi / 2;
- else if (a < 0)
- fi = pi + atan(a / b);
- else if (a == 0 && b < 0)
- fi = 3 * pi / 2;
- else if (a > 0 && b < 0)
- fi = 2 * pi + atan(a / b);
- printf("r = %f\nfi = %f", r, fi);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement