Menu

[solved] – Question 94800

Problem Statement:
Take user input for 2 numbers (num1 and num2). Write a program to perform the following operations:
Add = num1 + num2
Subtract = num1 – num2
Divide = num1 / num2
Modulus = num1 / num2
Multiply = num1 * num2
Find the greater of the 2 numbers, unless both numbers are equal (where you can display “numbers are equal”).

Note:
If a user enters a non-numeric entry (for any of the 2 numbers), exit the program with a message “Incorrect input, program exiting!!” displayed on screen.
The program should be able to accept any (both whole number and/or decimal, positive, negative etc.) numeric entries.
If one or more operations are not (mathematically) possible on the 2 numbers (e.g. 0/0), display a message, on screen, for the operation/operation(s), e.g. “Division – Operation not possible.”

Example Program Output
If the two numbers entered, by user, were 3 and 8. Display on screen
“Sum of” 3 “and” 8 “Is” 11
“Modulus of ” 3 “and” 8 “is” 3
“Greater number of” 3 “and” 8 “is” 8.

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *