Answer to Question #52789 in C for raghu

Question #52789
Write a program that converts a number in Cartesian coordinates to polar form. The user will enter two values (real and imaginary parts of the number). The program will display the values of and r and O.
1
Expert's answer
2015-06-01T01:42:21-0400
#include <stdio.h>
#include <math.h>
int main()
{
double x, y;
scanf("%lf%lf", &x, &y);
double r, O;
r = sqrt(x*x + y*y);
O = atan(y/x);
printf("r = %lf\nO = %lf", r, O);
return 0;
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS