# Write and test a MIPS assembly language program to compute and print the first 100 prime numbers.

## Question:

Write and test a MIPS assembly language program to compute and print the first 100 prime numbers. A number n is prime if no numbers except 1 and n divide it evenly. You should implement two routines:

■ Test_prime (n) Return 1 if n is prime and 0 if n is not prime.

■ Main () Iterate over the integers, testing if each is prime. Print the first 100 numbers that are prime.

Test your programs by running them on SPIM.

Fantastic news! We've Found the answer you've been seeking!

## Step by Step Answer:

**Related Book For**

## Computer Organization and Design The Hardware Software Interface

**ISBN:** 978-0124077263

5th edition

**Authors:** David A. Patterson, John L. Hennessy