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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started