Example 12: Find the Position of a Point
Learn how to locate the position of a point in the circle.
We'll cover the following
Problem
Given the coordinates (x, y) of the centre of a circle and its radius, write a program that will determine whether a point lies inside the circle, on the circle, or outside the circle.
The following formulae will help you in the required calculations:
The output should be printed as a string on the console:
- outside
- inside
- on
Get hands-on with 1400+ tech skills courses.