啊哈磊_编程从这里起步
标题:
为什么没有执行if后的输出,而是直接执行else的输出了
[打印本页]
作者:
段凯博
时间:
2019-11-8 19:44
标题:
为什么没有执行if后的输出,而是直接执行else的输出了
#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;
}
复制代码
欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/)
Powered by Discuz! X3.2