Question: Write a program which prints the sum of two numbers taken from user at runtime . We'll write a program named add2.asm that computes the
Write a program which
prints the
sum of two numbers
taken
from
user at runtime
.


We'll write a program named add2.asm that computes the sum of two numbers specified by the user at runtime, and displays the result on the screen The algorithm this program will follow is: 1. Read the two numbers from the user. We'll need two registers to hold these two numbers. We can use t0 and t1 for this. a. Get first number from user, put into to. i. load syscall read_int into v0, iii. move the number read into St0. i. load syscall read_int into v0, iii. move the number read into t1. i. perform the syscall, b. Get second number from user, put into $tl i. perform the syscall, 2. Compute the sum. We'll need a register to hold the result of this addition. We can use St2 for this. 3. Print the sum
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
