Figure 3.7 (a) Points inside and outside of the circle. (b) Points inside and outside of the rectangle. у-аxis A (9, 9) (4, 5) (0, 0) х-ахis (a)
How would I code this



Since you are not specifying any language for implementation, I choose C language.
Program
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int x, y, x2, y2, r;
float pc;
printf("Enter the center co-ordinates of the circle: ");
scanf("%d %d", &x, &y);
printf("Enter the radius of the circle: ");
scanf("%d", &r);
printf("Enter the point co-ordinates: ");
scanf("%d %d", &x2, &y2);
pc = sqrt(pow(x2-x, 2)+pow(y2-y,2));//check for distance between point and center point of circle
if(pc>r)
printf("Point (%d,%d) lies outside the circle.", x2, y2);
else if(pc<r)
printf("Point (%d,%d) lies inside the circle.", x2, y2);
else if(pc==r)
printf("Point (%d,%d) lies on the boundary of circle.", x2, y2);
else
printf("Invalid Entry of co-ordinates");
return 0;
}
Step by step
Solved in 2 steps with 2 images









