高一数学一题:编写一个程序,输入梯形的上底,下底和高的值,计算并输出其面积。

编写一个程序,输入梯形的上底,下底和高的值,计算并输出其面积。

INPTU "上底,下底,高";a,b,h
s=(a+b)*h/2
PRINT "梯形的面积为:";s
END
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-09-03
#include<stdio.h>
void main()
{
float s;
float m_Dtop=0;
float m_Dbottom=0;
float m_Dheight=0;
printf("请键入上底\n");
scanf("%f",&m_Dtop);

printf("请键入下底\n");
scanf("%f",&m_Dbottom);

printf("请键入高\n");
scanf("%f",&m_Dheight);
// scanf("%s,%s,%s",&m_Dtop,&m_Dbottom,&m_Dheight);
s=(m_Dtop+m_Dbottom)*m_Dheight/2;
printf("面积为=%f",s);
}
第2个回答  2009-09-03
这样的程序,已经是非常简单的了,建议楼主自己动手写一下,算法你肯定是没有问题,如果对语言的语法不熟悉的话,可以看下你学的语言的教材,看下例子,或者请教一下你身边会的同学

想在网上找人帮你的话,你至少得把用什么语言写出来吧?是C,C++,汇编,还是其他?
相似回答