📜  梯形公式的面积 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:06.494000             🧑  作者: Mango

代码示例3
/* 
     formula is : (base1 + base2) / 2 * height
 */
#include 
int main()
{
     double base1, base2, height, area;
     scanf("%lf %lf %lf", &base1, &base2, &height);

     area = (base1 + base2) / 2 * height; // applying formula
     printf("Area: %0.3lf\n", area);
     return 0;
}