You are on page 1of 2

Assignment #2 - MIPS

Due Date: 29-Sept-2009 at the beginning of class.

Problem 1: Basic Arithmetic


Write four programs: add.asm, mult.asm, div.asm, and sub.asm that each read in two
values and prints performs the specified arithmetic operation on those numbers, then
outputs the result and a newline on the screen.

Problem 2: Output
Write a program that outputs "Hello" on one line, and "World" on the second line, using
trap 101.

Problem 3: ASCIIZ Output


Redo Problem 2 using the ASCIIZ trap command.

Problem 4: Method Call


Write a program that includes a method called "newline". Combine all four parts of
Problem 1 into one program, using this newline method whenever you need to print a
newline.

Problem 5: Primes
Write a program that reads a number from the user and then prints "Yes" if it is prime and
"No" otherwise.

Problem 6: Factorial
Write a program that reads a number from the user and prints out the factorial of that
number.

Example:

5
120

(Because 5! = 5 * 4 * 3 * 2 * 1)
Problem 7: High Low
Program the classic "High Low" and "Reverse High Low" games!

You might also like