Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- ask1: .asciiz "Enter the first number: "
- ask2: .asciiz "Enter the second number: "
- sum: .asciiz "The sum is: "
- .text
- # Asks the user for first number
- li $v0, 4
- la $a0, ask1
- syscall
- # Gets the users input
- li $v0, 5
- syscall
- # Move input to $t0
- move $t0, $v0
- # Asks the user for second number
- li $v0, 4
- la $a0, ask2
- syscall
- # Gets the users input
- li $v0, 5
- syscall
- # Move input to $t1
- move $t1, $v0
- # Display the sum message
- li $v0, 4
- la $a0, sum
- syscall
- #adds the two numbers
- add $a0, $t0, $t1
- li $v0, 1
- syscall
Advertisement
Add Comment
Please, Sign In to add comment