Question: Write an MIPS program that computes the sum of the integers from 1 to 100 by addition: 1 + 2 + 3 + 4 +
Write an MIPS program that computes the sum of the integers from 1 to 100 by addition:
1 + 2 + 3 + 4 + 5 + ... + 98 + 99 + 100 Do this by using the blt macro (branch if less than). Before the loop, initialize a register to zero to contain the sum, initialize another register to one (to be the counter), and another register to 101 to mark the end of the sequence. Inside the loop, add the counter to the sum, increment the counter and blt back to the top of the loop if the counter is less than 101. Single-step the program until you get a good idea of how it is working. Then let the program run. To stop the program, use syscall with the code 10 in $v0.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
