First, write a subroutine that will sum the numbers (1+2+3+4+...+N), where the user enters N. Please use the instructions JNS and JumpI for the subroutine and return the result on a memory address.
Then write another subroutine that will multiply two numbers using repeated addition. For example, to multiply 20 and 5, you would need to calculate (20+20+20+20+20). Please use the instructions JNS and JumpI for the subroutine and return the result on a memory address.
Then, write a MARIE assembly program that will calculate (N! = 1 x 2 x 3 x 4 … x N), calling the subroutine that was created in the task above.
Finally, consider the range of inputs and outputs your program and subroutines can work with within the MARIE architecture.
Please see the pseudocode below:
Input N Call subroutine to calculate 1+2+3+4+…+N Output result1
Call subroutine to calculate 1 x 2 x 3 x 4 x … x N
Output result2
You are asked to submit a single Zip file (.zip) containing the MARIE Assembly .mas file that corresponds to the above tasks. Your .mas file needs to be able to compile on the MARIE Assembler Code Editor and subsequently run on the MARIE Simulator.
Your .mas file is expected to contain comments that explain your code.