Question: 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!
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
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(" \t If you entered the dimensions of a Triangle, \t\t then your area is: %d square feet. ", y);
printf("\t If you entered the dimensions of a Rectangle/square, \t\t then your area is: %d square feet. ", x);
printf("\t If you entered the dimensions of a Oval, \t\t then your area is approximately: %d square feet. ", z);
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
