#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int x1,y1,x2,y2,radius,dist,firstPart,secondPart;
printf("Enter the X co-ordinate of the Circle: ");
scanf("%d",&x1);
printf("Enter the Y co-ordinate of the Circle: ");
scanf("%d",&y1);
printf("Enter the radius Circle: ");
scanf("%d",&radius);
printf("Enter the X co-ordinate of the Point: ");
scanf("%d",&x2);
printf("Enter the Y co-ordinate of the Point: ");
scanf("%d",&y2);
firstPart = pow( x1 - x2 , 2 );
secondPart = pow( y1 - y2 , 2 );
dist = pow( firstPart + secondPart , 0.5 );
if(dist > radius)
printf("\nPoint lies outside the Circle.");
else if(dist < radius)
printf("\nPoint lies inside the Circle.");
else
printf("\nPoint lies on the Circle.");
getch();
}
Output:
Please have a look at the below lesson posted on my YouTube channel:
#include<conio.h>
#include<math.h>
void main()
{
int x1,y1,x2,y2,radius,dist,firstPart,secondPart;
printf("Enter the X co-ordinate of the Circle: ");
scanf("%d",&x1);
printf("Enter the Y co-ordinate of the Circle: ");
scanf("%d",&y1);
printf("Enter the radius Circle: ");
scanf("%d",&radius);
printf("Enter the X co-ordinate of the Point: ");
scanf("%d",&x2);
printf("Enter the Y co-ordinate of the Point: ");
scanf("%d",&y2);
firstPart = pow( x1 - x2 , 2 );
secondPart = pow( y1 - y2 , 2 );
dist = pow( firstPart + secondPart , 0.5 );
if(dist > radius)
printf("\nPoint lies outside the Circle.");
else if(dist < radius)
printf("\nPoint lies inside the Circle.");
else
printf("\nPoint lies on the Circle.");
getch();
}
Output:
Please have a look at the below lesson posted on my YouTube channel:
No comments:
Post a Comment