Question: 3) Write a MIPS assembly program to calculate the factorial of a given integer n. The factorial of n is defined as n!= n*(n-1)*...*1

3) Write a MIPS assembly program to calculate the factorial of a given integer n. The factorial of n is

3) Write a MIPS assembly program to calculate the factorial of a given integer n. The factorial of n is defined as n!= n*(n-1)*...*1 Note that 0! = 1. Algorithm for computing factorial: 1. INPUT n= 5; //given number n 2. f = 1; 3. while (n > 1) f = f * n; n = n - 1; } 4. OUTPUT 1; //factorial f = n! Requirements: 1. Input number n = 5, to be stored in memory location at address 0x00. 2. Register assignment: $aon; $s0n! 3. You must use the algorithm shown above. 4. The assembly program shall contain no more than 11 real MIPS instructions. 5. The factorial of 5 must be written to the memory location at address 0x10. 4

Step by Step Solution

3.30 Rating (144 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Heres a simple MIPS assembly program to calculate the factorial of a given integer nn and sto... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!