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 = /s (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 teminate the program.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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.
Transcribed Image 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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY