Question: Use MIPS assembly code to perform: 1) Sum all even numbers. 2) Sum all odd numbers. Hint: To decide if a number is even or
Use MIPS assembly code to perform:
1) Sum all even numbers.
2) Sum all odd numbers.
Hint:
To decide if a number is even or odd, you may want to use "srl" and then "sll" the previous result. Then, compare the result to its original value. If they are equal, it is even; otherwise it is odd.
e.g.
Suppose t = 5
Right shift t by 1 bit is 2.
Left shift 2 by 1 bit is 4.
Then, t is an odd number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
