BC26 计算三角形的周长和面积
#include<stdio.h>
#include<math.h>
int main()
{
int a = 0;
int b = 0;
int c = 0;
float p = 0;
float circumference =0.0;
float area=0.0;
scanf("%d %d %d",&a,&b,&c);
//知道三条边求面积,使用海伦公式
circumference=a+b+c;
p=circumference/2;
area=sqrt(p*(p-a)*(p-b)*(p-c));
printf("circumference=%.2f area=%.2f",circumference,area);
return 0;
}
https://blog.51cto.com/u_15460718/4839529
页:
[1]