Question: Develop a simple calculator program that reads two positive integer numbers a & b and then prompts the user to enter an operation char as
Develop a simple calculator program that reads two positive integer numbers a & b and then prompts the user to enter an operation char as follows:
Calculator operations:
Enter A for addition (a+b)
S for subtraction (a-b)
M for multiplication (a*b)
D for division (a/b)
R for remainder (a%b)
F for factorial of the sum of a and b
W for the power of a to b
Q for square root of the product of a and b.
E. for sum of even numbers in range
O. for sum of odd numbers in range
P for sum of prime numbers in range
V for reversing digits of the smaller of a and b (ex: 654 reverses to 456)
X for exit
- Program should keep running until user enters X.
- If the user enters any other code, the program should output a message indicating that character entered is not within the list, then it displays the list again.
- If the user enters a negative number for either a or b, the program should use it’s absolute value
- The program should be structured with at least five value returning functions ( F, E,O,P,V) along with main program
Step by Step Solution
3.39 Rating (158 Votes )
There are 3 Steps involved in it
To develop a simple calculator program based on the specifications outlined we can approach the task ... View full answer
Get step-by-step solutions from verified subject matter experts
