- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- float x,y,z,area,temp,zc;
-
- printf("请输入三条边");
- scanf("%f%f%f",&x,&y,&z);
- if(((x+y)>z)&&((y+z)>x)&&((x+z)>y))
- {
- zc=x+y+z;
- temp=(x+y+z)/2;
- area=sqrt(temp*(temp-x)*(temp-y)*(temp-z));
- printf("%f,%f",zc,area);
-
- }else
- printf("不能构成三角形");
- return 0;
- }
复制代码 |