C程序求三角形面积#include<stdio.h>#include<math.h>void main(){ int a,b,c; float p; double s; printf("输入三角形三边"); scanf("%d,%d,%d",&a,&b,&c); if((a+b)>c&&(a+c)>b&&(

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/21 04:27:00
C程序求三角形面积#include<stdio.h>#include<math.h>void main(){ int a,b,c; float p; double s; printf("输入三角形三边"); scanf("%d,%d,%d",&a,&b,&c); if((a+b)>c&&(a+c)>b&&(
xTn0}3Ԫ$v$dx $6&YĄHHC@\!n&q4q /ӲW;Ha;$ǟ~x6ӣWӯ6w.')hX<:f}$I[u X #c1bt^k㬈^Our LHz33IyL@DZ*mXVAsh[#W3<+ۈ*ULccIEWMLey7ꉋY۴u XLgi ԍy,ٰ~P]6*ZV~Hsbɼ\17u5,JY;~m#'Nj*kVp?pa ˷_" [u^RPz*X_4Kɝ5zKϗR(M;$gE:$|aоO8{WCDZUK J"ˆGrσLDQȓD`F])

C程序求三角形面积#include<stdio.h>#include<math.h>void main(){ int a,b,c; float p; double s; printf("输入三角形三边"); scanf("%d,%d,%d",&a,&b,&c); if((a+b)>c&&(a+c)>b&&(
C程序求三角形面积
#include<stdio.h>
#include<math.h>
void main()
{
 int a,b,c;
 float p;
 double s;
 printf("输入三角形三边");
 scanf("%d,%d,%d",&a,&b,&c);
 if((a+b)>c&&(a+c)>b&&(b+c)>a)
 {
  p=(a+b+c)/2;
  s=sqrt(p*(p-a)*(p-b)*(p-c));
  printf("面积=%lf\n",s);
 }
 else
  printf("输入边长不符合要求!\n");
}
 
为什么输入3,5,7;3,6,8;不对

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 

C程序求三角形面积#include<stdio.h>#include<math.h>void main(){ int a,b,c; float p; double s; printf("输入三角形三边"); scanf("%d,%d,%d",&a,&b,&c); if((a+b)>c&&(a+c)>b&&(