Question: Write an ARM program that implements a simple four-function calculator and prompts the user to enter a pair of decimal integers (A and B) followed
Write an ARM program that implements a simple four-function calculator and prompts the user to enter a pair of decimal integers (A and B) followed by a character that specifies one of the operators:
+ for addition to compute A+B
- for subtraction to compute A-B
* for multiplication to produce the product A*B
/ for division to produce the quotient A/B.
Input should be the pair of numbers followed by the operand followed by a return.
For example
5 5 + [enter]
Your program should display the result produced by performing the indicated operation on the two input operands A and B. Only the four operators listed above should be allowed and an attempt to divide by zero should be prohibited.
Define a separate function for each of the allowed operators and use the function names ADD, SUB, MUL, and DIV.
Upon return from the function, the main program should display the result on the console.
Please write the full code using scanf, switch statements, and subroutines to get the answer from the two inputs.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
