The long Assingment2. png has some information needed to complete the tasks please read before hand (I send you guys the file)
And the cubesum.txt is the code to manipulate(I also send it)
Tasks
Here are the tasks that you need to do:
int sum_odd_factorial(int n){
int sum = 0;
for(int i = 1; i <= n;i+="">=>
sum += factorial(i);
return sum;
}
where factorial is another function that you need to implement:
int factorial(int n)
{
int rv = 1;
for(int i = 1; i <=>=>
rv *= i;
return rv;
3. (20 points) Execute the program that you wrote in step 2 for input 11. Take a snapshot of the value of all the 32 MIPS registers before and after executing the program.
4. (20 points) Manipulate the program assembly code so that it it implements and prints out the return value of this function:
int nested_loop_test(int n){
for(int i = 1; i < n;i*="">
for(int j = i; j >=0; j--)
if(j % 2 == 0)
rv += (i + j);
else
rv += (2*i-3*j);
5. (20 points) Execute the program that you wrote in step 4 for input 20. Take a snapshot of the value of all the 32 MIPS registers before and after executing the program.
Deliverables
You need to submit a zip file compressing the following files:
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here