<< Home | <<C Programs Home



C PROGRAMS TO CHECK GIVEN POINT IS INSIDE, OUTSIDE OR ON THE STD. CIRCLE

Page<< C Programs Home
Page<< C Programs Home
  

C Program :

Given coordinates of a point (x,y) and radius of standard circle(having center at origin). Write a prog. to check the point is inside, outside or on the circle.

C Programming -->

/* PROG. TO CHECK GIVEN POINT IS INSIDE, OUTSIDE OR ON THE STD. CIRCLE */ #include<stdio.h> #include<conio.h> #include<math.h> main() { int r,x,y,d; clrscr(); printf("enter radius of circle and coordinate of point "); scanf("%d%d%d II,&r,&x,&y); d= x*x+y*y; /* distance of point from origin since center is origin */ if(d<=(r*r)) { if(d«r*r)) printf("points is inside the circle"); else printf("point is on the circle"); } else printf("point is outside the circle"); getch(); }
Page<< C Programs Home



 
Copyright © 2006-2012 ExamBlast.com Last Updated 08-April-2012