This is my program in C:
#include<stdio.h>
#include<math.h>
int main()
{ int x, y;
printf("Enter the cartesian coordinates to be converted into respective polar coordinates");
scanf(" %d %d", &x, &y );
float r = sqrt(pow(x,2) + pow(y,2));
float omega = atan(y/x);
printf("The required polar coordinates are: (%f, %f)", r, omega);
return 0;
}
Following input is made:
5 12
And I get:
The required polar coordinates are: (13.000000, 1.107149)
I think the output is only half correct.
I expected, if unit is radian, the output must be:
The required polar coordinates are: (13.000000, 0.3944444)
But the output comes out to be:
The required polar coordinates are: (13.000000, 1.107149)