Question: Task 04: Write an interactive C program that displays the following menu: 1. Find area of a triangle 2. Find volume and surface area of
Task 04: Write an interactive C program that displays the following menu: 1. Find area of a triangle 2. Find volume and surface area of a sphere. Please select your choice (1 or 2): The program then reads the menu choice and behaves as in the following table: Menu choice Program behavior The program prompts for and reads the lengths of the three sides of a triangle. It then computes and displays the area the triangle. Given a triangle with sides a, b, and c, Heron's formula for the triangle area is: S (a+bt )/2 The program prompts for and reads the radius r of a sphere. It then computes and displays the volume and the surface area of the sphere. [ Vohme r 3.14159 Surface Area Input other than 1, and 2 The program displays the following error message : Error: Wrong menu choice and then terminates Note: Assume that the values read by the program for options I, and 2 are in centimeters. For these options, your program must display appropriate units in the output. Solve the problem using switch-statement, then solve it again using multi-way if statement
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
