#include <stdio.h> #include <math.h> int main(){ int a,b,c; double area=0,perimeter=0; double s; if (scanf("%d",&a)!=EOF && scanf("%d",&b)!=EOF && scanf("%d",&c)!=EOF && (a+b)>c && (a+c)>b && (b+c)>a){ // 计算最大的5分钱个数 s = (a+b+c)/2.0; area = sqrt(s*(s-a)*(s-b)*(s-c)); perimeter = a+b+c; printf("area = %.2f; perimeter = %.2f",area,perimeter); }else{ printf("These sides do not correspond to a valid triangle"); } return 0; }
c语言编程练习题:7-70 输出三角形面积和周长
作者:yunjinqi
类别:编程
日期:2023-05-30 15:22:15
阅读:580 次
消耗积分:0 分
版权所有,转载本站文章请注明出处:云子量化, https://www.yunjinqi.top/article/195
最新文章
系统当前共有 406 篇文章