求大神解答👻C语言编程题:输入三个整数作为三角形的边,设能构成三
1个回答
展开全部
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[])
{
float a;
float b;
float c;
float perimeter;
float area;
float half_perimeter;
printf("请输入三边: \n");
scanf("%f%f%f",&a,&b,&c);
perimeter = a + b + c ;
half_perimeter = perimeter / 2;
area = sqrt(half_perimeter * (half_perimeter - a) * (half_perimeter - b) * (half_perimeter - c));
printf("三角形的周长为: %f,面积为:%f\n",perimeter,area);
return 0;
}
#include <math.h>
int main(int argc, char const *argv[])
{
float a;
float b;
float c;
float perimeter;
float area;
float half_perimeter;
printf("请输入三边: \n");
scanf("%f%f%f",&a,&b,&c);
perimeter = a + b + c ;
half_perimeter = perimeter / 2;
area = sqrt(half_perimeter * (half_perimeter - a) * (half_perimeter - b) * (half_perimeter - c));
printf("三角形的周长为: %f,面积为:%f\n",perimeter,area);
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询