Question: Write LMC programs to complete the following tasks. You may need to use the BRZ, BRP and BR commands here as well. For each task
Write LMC programs to complete the following tasks. You may need to use the BRZ, BRP and BR commands here as well. For each task you should submit annotated mnemonics:
- Ask the user for two numbers and multiply the two numbers and print out the product.
- Ask the user for two numbers and divide them and print out the quotient and the remainder.
- Ask the user for two numbers and print out the biggest.
For example: Test data: 7, 9; Expected output: 9
Test data: 9, 7; Expected output: 9
- Ask the user for two numbers. If they are the same then print 0, otherwise add them and print out the answer.
For example:
Test data: 3, 9; Expected output: 12
Test data: 7, 7; Expected output: 0
- Ask the user for one larger number and one factor of that number (e.g. 15 and 3, 20 and 5). The program should keep subtracting the smaller number until it reaches 0 - where it should print out 0.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
