Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Robert Entenmann
- #04/15/2018
- #Find Minimum and Maximum of 4 numbers
- .data
- Num1: .word 0
- Num2: .word 0
- Num3: .word 0
- Num4: .word 0
- Min1: .word 0
- Max1: .word 0
- Min2: .word 0
- Max2: .word 0
- Min3: .word 0
- Max3: .word 0
- msg1: .asciiz "Please input a number: "
- msg2: .asciiz "Please input a number: "
- msg3: .asciiz "The maximum of the four numbers is "
- msg4: .asciiz "The minimum of the four numbers is "
- .text
- .globl main #Start of main
- .ent main
- main:
- jal readtwo
- sw $t0, Num1
- sw $t1, Num2
- jal findminmax
- sw $t2, Min1
- sw $t3, Max1
- jal readtwo
- sw $t0, Num3
- sw $t1, Num4
- jal findminmax
- sw $t2, Min2
- sw $t3, Max2
- jal findminmax
- sw $t2, Min3
- sw $t3, Max3
- li $v0, 4
- la $a0, msg3
- syscall
- lw $a0, Max3
- li $v0, 1
- syscall
- li $v0, 4
- la $a0, msg4
- syscall
- lw $a0, Min3
- li $v0, 1
- syscall
- .end main #End of main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement