#include <stdio.h>
typedef struct Point {
float x,//abscice
y;//ordonate
} TPoint;
typedef struct Circle {
TPoint O;
float R;
} TCircle;
float sqrt2(float n) {
float x = n,
y = 1.0,
eps = 0.0000001;
while(x-y>eps) {
x = (x+y)/2;
y = n / x;
}
return x;
}
float sqr(float x) {return x*x;}
int main(int argc, char const *argv[]) {
float x,y,R,//the circle
x0,y0;//the point
printf("Introduceti Cercul: C(O,R)\n"); scanf("%f %f %f", &x
,&y
,&R
); printf("Introduceti Point: P(x,y)\n");
float dist = sqrt2(sqr(x-x0)+sqr(y-y0));
printf("Distance from the center of the circle to the Point = %f\n",dist
); dist -= R;
if(dist < 0) {
printf("%s\n", "The point is inside the Circle."); } else if(dist == 0) {
printf("%s\n", "The point is on the Circle."); } else {
printf("%s\n", "The point is outside the Circle."); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdCBQb2ludCB7CiAgICBmbG9hdCB4LC8vYWJzY2ljZQogICAgICAgICAgeTsvL29yZG9uYXRlCn0gVFBvaW50OwoKdHlwZWRlZiBzdHJ1Y3QgQ2lyY2xlIHsKICAgIFRQb2ludCBPOwogICAgZmxvYXQgUjsKfSBUQ2lyY2xlOwoKZmxvYXQgc3FydDIoZmxvYXQgbikgewogICAgZmxvYXQgeCA9IG4sCiAgICAgICAgICB5ID0gMS4wLAogICAgICAgICAgZXBzID0gMC4wMDAwMDAxOwoKICAgIHdoaWxlKHgteT5lcHMpIHsKICAgICAgeCA9ICh4K3kpLzI7CiAgICAgIHkgPSBuIC8geDsKICAgIH0KICAgIHJldHVybiB4Owp9CgpmbG9hdCBzcXIoZmxvYXQgeCkge3JldHVybiB4Kng7fQoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgY29uc3QgKmFyZ3ZbXSkgewoKICBmbG9hdCB4LHksUiwvL3RoZSBjaXJjbGUKICAgICAgICB4MCx5MDsvL3RoZSBwb2ludAogIHByaW50ZigiSW50cm9kdWNldGkgQ2Vy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