MARIE Programming Problems

Updated 2014.10.15

For all programs, put comments with your name and a brief description of the problem at the top of the program.

For all programs, get a printout of the LST file and hand it in.

For all programs, put the MAS (MARIE Assembly language) and MEX (MARIE EXecutable) files in the drop box. Put them in the drop box separately; don't zip them up.

Homework:

  1. Input two numbers and output their sum. In class.
  2. Input three numbers from the keyboard and output their sum.
  3. Display (output) the odd numbers from 1 to 99. You must use a loop.
  4. Input three numbers from the keyboard and output the largest of the three. To verify that your program works, test all 6 possibilities: 1-2-3, 1-3-2, 2-1-3, 2-3-1, 3-1-2, 3-2-1. You do not need to worry about the possibility of two numbers being equal.
  5. Input a list of numbers from the keyboard and output their sum. The size of the list is unknown, but the last number in the list is 0. The numbers may be positive or negative.
  6. Input a list of numbers from the keyboard and output the largest. The first number input will be an integer telling how many numbers follow in the list. You may assume that there will be at least 1 number input (the size of the list will not be 0). The numbers that are in the list may be positive, negative, or 0.
  7. Input two positive numbers from the keyboard and output their product. Since there is no multiply instruction on MARIE, use repeated addition.
  8. Input three numbers from the keyboard and output them in ascending order. Again, test all 6 possibilities (see above). The bubble-sort algorithm may be helpful here. You do not have to implement the entire bubble-sort algorithm, but I think you may want to model your solution on the bubble-sort algorithm.