Question: Write a Little Man program that prints out the sums of the odd values from 1 to 39. The output will consist of 1, 1+3,
Write a Little Man program that prints out the sums of the odd values from 1 to 39. The output will consist of 1, 1+3, 1+3+5, 1+3+5+7.... No input is required. As an aside, do you notice anything interesting about the output results that are produced by the series? (Hint: This series is sometimes used as part of an algorithm for finding square roots of numbers.)
Use the following LMC instruction set :
| Arithmetic | 1xx | Add |
| 2xx | Subtract | |
| Data movement | 3xx | store |
| 5xx | load | |
| Jump | 6xx | BR |
| Branch on zero | 7xx | BRZ |
| Branch on positive | 8xx | BRP |
| Input | 901 | Input |
| Output | 902 | Output |
| End | 000 | Halt |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
