Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DoMath - Put all the code in the main method The program will loop 4 times and, in each iteration, it will prompt the user

DoMath - Put all the code in the main method
The program will loop 4 times and, in each iteration, it will prompt the user for 2 integers with the prompts of "Enter num1: " and "Enter num2: ". You can assume that the user will provide an integer for each prompt. In the first iteration, add the input, in the second, subtract them (num1- num2), in the third iteration, multiply them, and in the final iteration divide (num1/num2). The output will be the four answers separated by a comma followed by a space. If num2 is zero when you do the division, the answer should be Error.
Sample run (with user input in bold)
Enter num1: 10
Enter num2: 20
Enter num1: 30
Enter num2: 40
Enter num1: 7
Enter num2: 8
Enter num1: 10
Enter num2: 0
30,-10,56, Error
Note: If the last input was 2, instead of 0, you would have a 5 instead of Error in the output
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions