c语言编三角形

来源:百度知道 编辑:UC知道 时间:2024/06/04 10:57:55
#include <stdio.h>

#include <math.h>

main()
{
float a,b,c,area;

float S=0.5*(a+b+c)

printf("Press enter "a" and then press ENter:);
a = gerchar();

printf("You pressed ");
putchar(a);
putchar('\n');

printf("Press enter "b" and then press ENter:);
b = gerchar();

printf("You pressed ");
putchar(b);
putchar('\n');

printf("Press enter "c" and then press ENter:);
c = gerchar();

printf("You pressed ");
putchar(c);
putchar('\n');

if(a>0&&b>0&&c>0)
area = sqrt(S*(S-a)*(S-b)*(S-c));
printf("area=%f\n", area);
}
帮我看下有什么错误 XX```
总是说我错呢``````帮帮忙````

#include<stdio.h>
#include<math.h>
main()
{
double a,b,c,s,area;
printf("请输入三角形三条边的长\n");
scanf("%lf %lf %lf",&a,&b,&c);
s=1.0/2*(a+b+c);
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("%lf %lf %lf\n",a,b,c);
printf("area=%f\n",area);
}
这个肯定可以!!

才5分?

#include <stdio.h>

#include <math.h>

void main()
{
float a,b,c,area;
float S;

printf("Press enter \"a\" and then press ENter:");
scanf("%f",&a);

printf("You pressed ");
printf("%f",a);
putchar('\n');

printf("Press enter \"b\" and then press ENter:");
scanf("%f",&b);

printf("You pressed ");
printf("%f",b);
putchar('\n');

printf("Pr