Program to calculate the Area of Circle from co-ordinates of the end points of the Diameter of Circle

//Program to calculate the Area of Circle from
//co-ordinates of the end points of the Diameter of Circle
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define pi 3.1416
int main()
{
  float x1,x2,y1,y2,d,area;
  clrscr();
  printf("Enter the co-ordinates of the Points of Diameter of the Circle\n");
  scanf("%f%f%f%f",&x1,&x2,&y1,&y2);
  d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/2;//To find out the Radius of Circle
  area=pi*d*d;
  printf("The Area of the Circle is = %f",area);
  getch();
  return 0;
}

To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

No comments:

Post a Comment