#include <stdio.h> #include <math.h> #define S(A,B,C) (((A) + (B) + (C)) / 2 ) #define AREA(A,B,C) sqrt(S(A,B,C) * (S(A,B,C) - A) * (S(A,B,C) - B) * (S(A,B,C) - C))
int main(int argc, char *argv[]) { int a,b,c; float area; printf("please input a,b,c:"); scanf("%d,%d,%d",&a,&b,&c); area = AREA(a,b,c); if (a + b > c && a + c > b && b + c > a) { printf("the area is : %.2f",area); } else { printf("is not a triangle!"); } system("pause"); return 0; }
|