PART 1 Write code for the LMC for the following tasks. (15*3 =45) In addition to the commands INP, OUT, STA, LDA, ADD, S
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
PART 1 Write code for the LMC for the following tasks. (15*3 =45) In addition to the commands INP, OUT, STA, LDA, ADD, S
PART 1 Write code for the LMC for the following tasks. (15*3 =45) In addition to the commands INP, OUT, STA, LDA, ADD, SUB, DAT and HLT, you will also need to use the branching instructions such as BRZ, BRP and BRA commands. For each task below, you should submit annotated mnemonics, that is, submit the code together with comments explaining what each line of code does: A. Ask the user for two numbers and print out the biggest. For example, Test data Expected output 7,9 9 8,7 12,9 8 12 B. Ask the user for three numbers and print out all three from largest to smallest. For example, Test data Expected output 3, 16,5 16,5, 3 4,5,20 20,5,4 C. Ask the user to input two numbers. If the first number is greater than the second, output 1; if the second number is greater than the first, output -1, and if the two numbers are the same, output 0. Test data Expected output 12,5 6,13 8,8 1 -1 0
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!