luc005.c ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 12 Dec 2025
- License — MIT
Problem Statement ​
Problem Statement
Write a program to recive Cartesian co-ordinates (x, y) of a point and convert them into Polar co-ordinates (r, phi) Hint : r = sqrt (x^2 + y^2) and phi = tan^-1 (y/x)
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include <stdio.h>
#include <math.h>
int main()
{
double x, y, r, phi;
printf("Enter the Cartesian Co-Ordinates in this format 'x, y' : ");
scanf("%lf, %lf", &x, &y);
r = sqrt(pow(x, 2) + pow(y, 2));
phi = atan2(y, x);
printf("\nPolar Co-Ordinates are : (%g, %g Rad)", r, phi);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12