fork download
  1. #include <stdio.h>
  2.  
  3. // Prototype declaration
  4. float calcAreaOfTrapezoid(float widthBase, float widthTop, float height);
  5.  
  6.  
  7. // function definition
  8. float calcAreaOfTrapezoid(float widthBase, float widthTop, float height)
  9. {
  10. float area = ((widthBase + widthTop) * height)/2; // calculate area of the trapezoid
  11.  
  12. return area;
  13. }
  14.  
  15. int main ( )
  16. {
  17.  
  18. float area = calcAreaOfTrapezoid (5,5,5);
  19.  
  20. printf("\nThe area of the trapezoid is %f\n", area);
  21.  
  22.  
  23.  
  24. return (0);
  25.  
  26. }
Success #stdin #stdout 0s 5308KB
stdin
60
40
stdout
The area of the trapezoid is 25.000000