我是大一新生,求大神教育
这是我编的/*给10z组a b c求证若组成三角形求其周长 面积(精确小数点两位) 不成立输出a b c*/
#include<stdio.h>
#include<math.h>
int main(void)
{
int i;
double a,s,b,c,m,area; /*m为周长,area为面积*/
for(i=1;i<=10;i++){
printf("enter a b c:");
scanf("a=%lf,b=%lf,c=%lf\n",a,b,c);
if(a+b>c&&a-b<c){
m=a+b+c;
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("m=%.2f,area=%.2f\n",m,area);
}
else{
printf("a=%.2f,b=%.2f,c=%.2f\n",a,b,c);
}
}
return 0;
}
输出结果是乱码 好多数字
enter a b c:4 5 6
a=-92559631349317831000000000000000000000000000000000000000000000.00,b=-92559631
349317831000000000000000000000000000000000000000000000.00,c=-9255963134931783100
0000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
enter a b c:a=-92559631349317831000000000000000000000000000000000000000000000.00
,b=-92559631349317831000000000000000000000000000000000000000000000.00,c=-9255963
1349317831000000000000000000000000000000000000000000000.00
Press any key to continue