luc005.c
Problem Statement
luc005.c
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
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
● Author - Amit Dutta · Updated - 12 Dec 2025