fork download
  1. #include <stdio.h>
  2. function();
  3.  
  4. float calcAreaofTriangle(float width, float height);
  5.  
  6.  
  7. int main(void) {
  8. // your code goes here
  9. float area;
  10. float height;
  11. float width;
  12. float calcAreaofTriangle;
  13. return 0;
  14.  
  15. }
  16. // **************************************************
  17. // Function: calcAreaOfRectangle
  18. //
  19. // Description: Calculates the area of a Rectangle
  20. //
  21. //
  22. // Parameters:
  23. // base - base of the Triangle
  24. // height - height of the Triangle
  25. //
  26. //
  27. // Returns: area - area of Triangle
  28. //
  29. // ***************************************************
  30.  
  31. float calcAreaOfTriangle(float width, float height) // float width and height
  32. {
  33.  
  34. float area; // area of the Rectangle
  35.  
  36. printf("Enter the Width in inches"); // prompt for width input
  37. scanf("%f", &width); // read in width
  38.  
  39. printf("Enter the height in inches"); // prompt for height input in inches
  40. scanf("%f", &height); // read in width
  41. // calculate area
  42. area = width * height * .5; // Area of triangle is .5 x W x H plugin variables
  43.  
  44.  
  45. printf("The area is : %f\n", area); // Display the area according to calculation
  46.  
  47. return (area);
  48. } //calcAreaOfTriangle
Success #stdin #stdout 0.01s 5296KB
stdin
5, 5 
stdout
Standard output is empty