Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that takes a user\'s input (X) to find and display the area (A)

ID: 3639977 • Letter: W

Question

Write a program that takes a user's input (X) to find and display the area (A) for the following:
• A square with sides X, where A = X^2
• A circle with radius X, where A = 3.14 * X^2
• An equilateral triangle with side X, where A = Sqrt(3)/4 * X^2

I want you to create and use the following value returning functions in your program:
• AreaSquare(Side) As Float
o Returns the area of the square as a float
• AreaCircle(Radius) As Float
o Returns the area of the circle as a float
• AreaEqTriangle(Side) As Float
o Returns the area of the equilateral triangle as a float

Explanation / Answer

//Command to Compile cc filename.c -lm //Command to run ./a.out #include #include float AreaSquare(float Side) { return (Side*Side); } float AreaCircle(float Radius) { return (3.14*Radius*Radius); } float AreaEqTriangle(float Side) { return (Side*Side*sqrt(3)/4); } int main() { float x; printf("Enter X: "); scanf("%f",&x); printf("Area of Square: %f ",AreaSquare(x)); printf("Area of Circle: %f ",AreaCircle(x)); printf("Area of Equilateral Triangle: %f ",AreaEqTriangle(x)); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote