#include <math.h> #include <stdio.h> int main() { int a, b, c = 0; do { scanf("%d %d %d", &a, &b, &c); } while (a + b <= c || a + c <= b || b + c <= a); float circumference = 0;//周长 float area = 0; float half_circumference = 0;//半周长——>用来计算面积 half_circumference = (a + b + c) * 1.0 / 2; circumference = a + b + c; area = sqrt(half_circumference * (half_circumference - a) * (half_circumference - b) * (half_circumference - c)); printf("circumference=%.2f area=%.2f", circumference, area); return 0; }