...

/

Example 2: Conversion from Cartesian to Polar Coordinates

Example 2: Conversion from Cartesian to Polar Coordinates

Learn how to convert Cartesian Coordinates (x, y) of a point to its polar coordinates (r, theta).

We'll cover the following...

Problem

In mathematics, a point in a plane can be represented using either the Cartesian Coordinate system or the Polar coordinate system.

Write a function that receives Cartesian Coordinates x and y of a point, and convert them into its polar coordinates r and θ\theta.

Remember to print the result in two decimal places.

Example

Input (x , y) Output (r , θ\theta)
12 , 12 16.97 , 45.00
12 , 5 13.00 , 22.62

Try it yourself

Try to solve this question on your own in the code widget below. If ...

Access this course and 1400+ top-rated courses and projects.