题解 | #计算三角形的周长和面积#
计算三角形的周长和面积
https://www.nowcoder.com/practice/109a44d649a142d483314e8a57e2c710
#include <stdio.h> int main() { int a = 0; int b = 0; int c = 0; scanf("%d %d %d", &a, &b, &c); float cir = a + b + c; float p = 0; float area = 0; if (a, b, c > 0 && a, b, c < 10000) { if (a + b > c && b + c > a && a + c > b) { cir = a + b + c; p = cir/2; area = sqrt(p * (p - a) * (p - b) * (p - c)); } } printf("circumference=%.2f area=%.2f",cir, area); return 0; }