forked from mecchmatProjects/CppCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.6.c
More file actions
40 lines (35 loc) · 880 Bytes
/
2.6.c
File metadata and controls
40 lines (35 loc) · 880 Bytes
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
36
37
38
39
40
//2.6
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double dovzhinaVidrizka(int x1, int x2, int y1, int y2) {
return sqrt(pow(x2-x1,2)+pow(y2-y1,2));
}
double Square(double a, double b, double c) {
double p = (a + b + c) / 2;
double s = pow(p*(p - a)*(p - b)*(p - c),0.5);
return s;
}
int main(int argc, char *argv[]) {
int xA, yA;
int xB, yB;
int xC, yC;
printf("Enter xA, yA: ");
scanf("%d", &xA);
scanf("%d", &yA);
printf("\n");
printf("Enter xB, yB: ");
scanf("%d", &xB);
scanf("%d", &yB);
printf("\n");
printf("Enter xC, yC: ");
scanf("%d", &xC);
scanf("%d", &yC);
printf("\n");
double AB = dovzhinaVidrizka(xA, xB, yA, yB);
double AC = dovzhinaVidrizka(xA, xC, yA, yC);
double BC = dovzhinaVidrizka(xB, xC, yB, yC);
double res = Square(AB, AC, BC);
printf("%.2f", res);
return 0;
}