Question: Write a simple calculator that operates as described here: 1 . The program starts by asking the user for two integers, which are stored in

Write a simple calculator that operates as described here:
1. The program starts by asking the user for two integers, which are stored in variables
having the type of int.
2. Program asks whether the user wants to 1) add, 2) subtract, 3) multiply or 4) divide the
numbers.
3. Next, the calculator will perform the desired operation and output the result.
4. If the user tries to divide by zero, then the calculator gives an error message "Zero
cannot be used as a divisor." The result of the division operation must be rounded to
two decimal places.
Note: If the user does not select 1-4, the program prints the text "The operation was not
recognized."

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 Programming Questions!