编程序: 输入梯形的上底,下底和高,输出该梯形的面积(要求有必要的提示信息,小数点保留两位)

如题所述

第1个回答  2011-02-07
#include<stdio.h>
void main()
{
float l,w,h,s;
printf("length:");
scanf("%f",&l);
flushall();
printf("width:");
scanf("%f",&w);
flushall();
printf("height:");
scanf("%f",&h);
s=(l+w)*h/2.0;
printf("area=%f",s);
}
第2个回答  2011-02-08
#define PI 3.14
main()
{
float r,s;
scanf("%f",&r);
s=PI*r*r;
printf("%f\n",s);
}本回答被提问者采纳
第3个回答  2020-01-15
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
float a,b,c;
cin>>a>>b>>c;
float sb666=(a+b)*c/2;
cout<<setprecision(3)<<sb666<<endl;
return 0;
}
第4个回答  2011-02-07
#include<stdio.h>
int main()
{
double a,b,c;
double s;
printf("输入梯形的上底:\n");
scanf("%lf",&a);
printf("输入梯形的下底:\n");
scanf("%lf",&b);
printf("输入梯形的高:\n");
scanf("%lf",&c);

s=(a+b)*c/2.0; //计算面积 上底加下底乘以高除以2

printf("梯形的面积为:\n");
printf("%.2lf\n",s);
return 0;
}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网