Question: 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
 DoMath - Put all the code in the main method The

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!