第三章第10题

来源:互联网 发布:yes淘宝刷信用 编辑:程序博客网 时间:2024/05/17 06:15
#include<stdio.h>#include<math.h>void pan(float a,float b,float c){   float d,e;if((a+b>c)&&(a+c>b)&(b+c>a)){d=(a+b+c)/2;e=sqrt(d*(d-a)*(d-b)*(d-c));printf("合理,面积为%f\n",e);}elseprintf("不合理,请重新输入\n");}int main(){ float a,b,c;while(1)  {printf("\n请输入第一个边:");scanf("%f",&a);printf("\n请输入第二个边:");scanf("%f",&b);printf("\n请输入第三个边:");scanf("%f",&c);pan(a,b,c);}return 0;}

0 0