输入三角形的三条边,得出这个三角形的类型和面积
#include <stdio.h> #include <math.h> int main(void) { float a,b,c,s,area; int type = 0; scanf("%f,%f,%f",&a,&b,&c); if(a+b<c || b+c<a || c+a<b){ printf("err"); return 0; } s = (a+b+c)/2; area = (float)sqrt(s*(s-a)*(s-b)*(s-c)); if(a == b & b == c) type = 1; if(a == b || a == c || c == b) type = 2; if( (a*a + b*b == c*c) || (b*b + c*c == a*a) || (c*c + a*a == b*b)) type = 3; printf("type = %d \n",type); printf("area = %f \n",area); return 0; }