1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-03 17:26:21 +00:00
202401-programming-assignments/【额外练习】选择结构/7-18 选择-三角形面积.c

18 lines
348 B
C
Raw Normal View History

2024-10-30 15:00:18 +00:00
#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;
}