## C Programming

### Check a point is inside,outside or on the circle

#### Objective:

Input the coordinate (x,y) for the center point of a circle and it's the radius. Input coordinate (p,q) for another point and check the point is inside the circle, outside the circle, or on the circle.

#### Program/Solution:

```#include<stdio.h>
#include<math.h>

int main() {
int x,y;
int p,q;
float r,d;

printf("Enter the center point of circle: ");
scanf("%d %d",&x,&y);

printf("Enter the radius of circle: ");
scanf("%f",&r);

printf("Enter the other points cordinates: ");
scanf("%d %d",&p,&q);

//calculate distance between (x,y) and (p,q)
d = sqrt((x - p) * (x - p) + (y - q) * (y - q));

if(d > r) {
printf("Point is outside the circle");
}else if(d < r) {
printf("Point is inside the circle");
}else {
printf("Point is on the circle");
}
return 0;
}
```

#### Sample Output:

```Enter the center point of circle: 5 5
Enter the radius of circle: 10
Enter the other points cordinates: 10 9
Point is inside the circle
```