-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.c
35 lines (29 loc) · 806 Bytes
/
circle.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
float Edistance(int x1, int y1, int x2, int y2)
{
int a = (y2-y1)*(y2-y1)+(x2-x1)*(x2-x1);
return sqrt(a);
}
float areaOfCircle(int x1, int y1, int x2, int y2, float (*distance)(int x1, int y1, int x2, int y2))
{
return distance(x1, y1, x2, y2);
}
int main()
{
int x1, y1, x2, y2;
float dst;
// Take x1, y1 and x2, y2 from the user using scanf
printf("Enter the value of x1\n");
scanf("%d", &x1);
printf("Enter the value of y1\n");
scanf("%d", &y1);
printf("Enter the value of x2\n");
scanf("%d", &x2);
printf("Enter the value of y2\n");
scanf("%d", &y2);
dst = areaOfCircle(x1, y1, x2, y2, Edistance);
printf("The distance between these points is %.2f\n", dst);
return 0;
}