C Program To Check If Point Lies Inside, Outside or On The Circle

preview_player
Показать описание

Given the coordinates(cx, cy) of center of a circle and its radius, write a C program that will determine whether a point lies inside the Circle, on the Circle or outside the Circle. (Hint: Use sqrt() and pow() functions)

Note:
Center Point – (cx, cy);
We need to find the position of point (x, y);

Logic To Check whether Point Lies Inside, Outside or On The Circle
First we need to calculate the distance of the point from the center of the circle. Next we need to compare the distance with the radius of the Circle.

Conditions To Determine The Position of the Point(x, y)
1. Distance is greater than radius: point is outside the Circle.
2. Distance is less than radius : point is inside the Circle.
3. Distance is equal to the radius: point is on the Circle.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

the way you explain is really nice and easy thank you so much.

myarchitecturallife
Автор

Thank you so much brother it helped me for my assignment 🔥🔥🔥🔥

darklxrd
Автор

In printf part why have you written %0.2f%0.2f instead of %f%f ?

rohitgupta
Автор

sir,
Distace=sqrt(pow( (cx-x), 2)+pow( (cy-y), 2) );
why we have used 2 after pow( (cx-x ), 2 ) in both pow( (cy-y ), 2 )
Please Answer

sahilsharma-cqsl