Question: Write a console program (character based) to do simple calculation (addition, subtraction, multiplication and division) of two numbers using your understanding of control flow, input

Write a console program (character based) to do simple calculation (addition, subtraction, multiplication and division) of two numbers using your understanding of control flow, input validations and error conditions in C.

Description: You need to write a program that when run will display a menu. The menu gives five choices of operation: addition, subtraction, multiplication, division and a last choice to exit the program. It then gives a prompt and waits for the user to make a choice of calculation they want to do. Once user selects the operation it will check for valid menu choices (and give an appropriate message if a wrong choice was selected) and then prompts to enter two numbers separated by a space. If the user entered valid numbers it will do the operation desired and then displays the result. If user input is not valid displays an error message and asks for the correct input. At the end of the result, it gives a prompt Press enter key to continue .. Once enter key is pressed, it displays the menu again. Program repeats until user selects a choice to exit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!