為什么這兒定義p和s用double?
#include?<stdio.h>
#include?<math.h>?
??int?main()
{int?a,b,c;
double?p,s;?
printf("please?input?the?value?of?a,b,c\n");
scanf("%d?%d?%d",&a,&b,&c);
if(a+b>c&&a-b<c)
{
p=(a+b+c)/2.0;??
s=sqrt(p*(p-a)*(p-b)*(p-c));
printf("Yes,this?is?a?triangle!\nthe?area?is?%.2f\n",s);
}
else?printf("No,this?is?not?a?triangle!\n");
return?0;
}
2022-03-24
為了規(guī)范性還是加上比較好難道是<p></p>之間?
2018-12-13
int定義整數(shù),比如2,3,4,-1,-5。但是有小數(shù)的數(shù)字不能用int來定義,需要double來定義含有小數(shù)的數(shù)字。