Write a complete C program to calculate the perimeter and area of a triangle with 3 sides namely a, b, and c. The sides will be given as inputs by the user. The program will be executed at least once,...



Write a complete C program to calculate the perimeter and area of a triangle with 3 sides
namely a, b, and c. The sides will be given as inputs by the user. The program will be
executed at least once, and repeat as long as the user wishes to calculate again.




Write a complete C program to calculate the perimeter and area of a triangle with 3 sides<br>namely a, b, and c. The sides will be given as inputs by the user. The program will be<br>executed at least once, and repeat as long as user wish to calculate again.<br>There are a total of 5 functions:<br>• Function 1:<br>o This function will display the menu options that the user can choose (to<br>calculate perimeter or area of a triangle).<br>• Function 2:<br>o This function will calculate the perimeter of a triangle<br>o Accepts the sides of triangle as parameter<br>o Formula: perimeter = a + b + c<br>o Return the result back to the caller.<br>• Function 3:<br>o This function will calculate the area of a triangle<br>o Accepts the sides of triangle as parameter<br>o Formula: area = 5 (s – a)(s – b)(s – c), where s = (a + b + c)/2<br>o Return the result back to the caller.<br>Function 4:<br>o This function will get the sides of triangle from user.<br>o Ask user for option on what s/he would like to calculate.<br>o Based on the option (Use switch case statement)<br>• call the necessary function<br>· identify the type of calculation (

Extracted text: Write a complete C program to calculate the perimeter and area of a triangle with 3 sides namely a, b, and c. The sides will be given as inputs by the user. The program will be executed at least once, and repeat as long as user wish to calculate again. There are a total of 5 functions: • Function 1: o This function will display the menu options that the user can choose (to calculate perimeter or area of a triangle). • Function 2: o This function will calculate the perimeter of a triangle o Accepts the sides of triangle as parameter o Formula: perimeter = a + b + c o Return the result back to the caller. • Function 3: o This function will calculate the area of a triangle o Accepts the sides of triangle as parameter o Formula: area = 5 (s – a)(s – b)(s – c), where s = (a + b + c)/2 o Return the result back to the caller. Function 4: o This function will get the sides of triangle from user. o Ask user for option on what s/he would like to calculate. o Based on the option (Use switch case statement) • call the necessary function · identify the type of calculation ("Perimeter" or “Area") • identify the calculation unit (“cm" or “cm2") o Then, print out the result. • Function 5: o This is the main function o Call the function that is used to display the menu. o Call the function that is used to ask for inputs, calculate and display result. o Ask if user wish to calculate again. • Repeat as long as user wishes to. o If user wish to stop calculate, display "Thank you!" and terminate the program.
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here