1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 15:48:42 +00:00
202401-programming-assignments/【额外练习】选择结构/7-18 选择-三角形面积.c

18 lines
348 B
C

#include <stdio.h>
int main() {
double a, b, c;
scanf("%lf%lf%lf", &a, &b, &c);
if (a + b > c && a + c > b && b + c > a) {
double p = (a + b + c) / 2;
double s = sqrt(p * (p - a) * (p - b) * (p - c));
printf("%.2lf %.2lf\n", s, a + b + c);
} else {
printf("no triangle\n");
}
return 0;
}