Skip to content

Commit a2d4f83

Browse files
authored
Merge pull request #446 from Mayuri-cell/Mayuri-cell-patch-4
Circle points
2 parents 49948f1 + 96f2364 commit a2d4f83

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

General Questions/circle_and_point.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* Title : To find whether a given point lies on the circumference
2+
of the circle , inside the circle or outside the circle .
3+
4+
Description : User needs to provide the center co-ordinates and radii
5+
of a circle . And the point for which you want to find.
6+
*/
7+
#include<stdio.h>
8+
#include<conio.h>
9+
int main()
10+
{
11+
float h , k;
12+
printf("\n Enter the X , Y center co-ordinates of a circle : \n");
13+
scanf("%f %f",&h ,&k);
14+
printf("\n Enter the radius :\n");
15+
float radii;
16+
scanf("%f",&radii);
17+
float eqn;
18+
float x ,y;
19+
printf("\n Enter the X and Y co-ordinates of point A : \n");
20+
scanf("%f %f",&x ,&y);
21+
float t=(h*h)+(k*k)-(radii*radii);
22+
eqn=(x*x)-(2*h*x)+(y*y)-(2*k*y)+t;
23+
printf("Equation of the circle : (x-%0.2f)^2 + (y-%0.2f)^2 -%0.2f \n",h,k,radii*radii);
24+
if(eqn<0)
25+
{
26+
printf("\n Inside the circle ");
27+
}
28+
else if(eqn>0)
29+
{
30+
printf("\n Outside the circle ");
31+
}
32+
else if(eqn==0)
33+
{
34+
printf("\n On the circumference of the circle .\n");
35+
}
36+
return 0;
37+
}

0 commit comments

Comments
 (0)