1. Engineering
  2. Computer Science
  3. hello can someone please fix these errors its due in...

Question: hello can someone please fix these errors its due in...

Question details

Hello, can someone please fix these errors? It's due in a couple hours and I need to get this done ASAP. C programming

Thank you!

#include <stdio.h>

void printArea(int, int, int); //function pro
float triangle(int, float);
float rect(int, float);
float oval(int, float);
int getLength();
int getHeight();
main() //function call

{
   float R, T, O;
   int length, height;
  
   length = getLength();
  
   height = getHeight();
  
   printArea(R, T, O);
  
   R = rect(length, height);
   T = triangle(length, height);
   O = oval(length, height);
  
   return 0;

}


getLength() // function for input length.

{
   int length;

   printf("Enter the length: ");

   scanf("%d",&length);

   return length;
}

getHeight() // function for input height.

{
   int height;

   printf("Enter the height: ");

   scanf("%d",&height);

   return height;

}

int rect(int x ,int y) //func to calculate area of rectangle.

{

   return x*y;

}

int triangle(int x ,int y) //func to calculate area of triangle.

{

   return (0.5*x*y);

}

int oval(int x ,int y) //func to calculate area of oval.

{
   return (int)(0.8*(double)x*(double)y);

}

void printArea(int x,int y, int z) //func to print area of all shapes.

{   
  
   printf("\n\t If you entered the dimensions of a Triangle, \n\t\t then your area is: %d square feet. \n\n", y);

   printf("\t If you entered the dimensions of a Rectangle/square, \n\t\t then your area is: %d square feet. \n\n", x);

   printf("\t If you entered the dimensions of a Oval, \n\t\t then your area is approximately: %d square feet. \n\n", z);

}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution