帮我再看看这个C语言程序哪错了,求三角形的面积和周长#include#includeint main(void){double a,b,c,s,area,perimeter;printf("Enter 3 sides of the triangle:");scanf("%lf%lf%lf\n",&a,&b,&c);s=(a+b+c)/2;if((a+b>c)&&(a+c>b)&&(b+c>a)){ar

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 08:13:32
帮我再看看这个C语言程序哪错了,求三角形的面积和周长#include#includeintmain(void){doublea,b,c,s,area,perimeter;printf("Enter3s

帮我再看看这个C语言程序哪错了,求三角形的面积和周长#include#includeint main(void){double a,b,c,s,area,perimeter;printf("Enter 3 sides of the triangle:");scanf("%lf%lf%lf\n",&a,&b,&c);s=(a+b+c)/2;if((a+b>c)&&(a+c>b)&&(b+c>a)){ar
帮我再看看这个C语言程序哪错了,求三角形的面积和周长
#include
#include
int main(void)
{
double a,b,c,s,area,perimeter;
printf("Enter 3 sides of the triangle:");
scanf("%lf%lf%lf\n",&a,&b,&c);
s=(a+b+c)/2;
if((a+b>c)&&(a+c>b)&&(b+c>a))
{area=sqrt(s*(s-a)*(s-b)*(s-c));
perimeter=a+b+c;
printf("area=%.2f;perimeter=%.2f\n",&area,&perimeter);}
else
printf("Three sides do not correspond to a valid triangle\n");
return 0;
}

帮我再看看这个C语言程序哪错了,求三角形的面积和周长#include#includeint main(void){double a,b,c,s,area,perimeter;printf("Enter 3 sides of the triangle:");scanf("%lf%lf%lf\n",&a,&b,&c);s=(a+b+c)/2;if((a+b>c)&&(a+c>b)&&(b+c>a)){ar
#include
#include
int main()
{
double a,b,c,s,area,perimeter;
printf("Enter 3 sides of the triangle:");
scanf("%lf%lf%lf",&a,&b,&c);
s=(a+b+c)/2;
if((a+b>c)&&(a+c>b)&&(b+c>a))
{
area=sqrt(s*(s-a)*(s-b)*(s-c));
perimeter=a+b+c;
printf("area=%.2f;perimeter=%.2f\n",area,perimeter);
}
else
printf("Three sides do not correspond to a valid triangle\n");
return 0;
}
有两个错误,首先是输入的时候错误,scanf("%lf%lf%lf",&a,&b,&c);这个里面不用加\n,还有旧书输出的时候错误,不要再前面加个&