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:

  1. Ask the user for two numbers and multiply the two numbers and print out the product.
  2. Ask the user for two numbers and divide them and print out the quotient and the remainder.
  3. 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

  1. 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

  1. 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

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!