.data firstNumPrompt: .asciiz "Enter the first number: " secNumPrompt: .asciiz "Enter the second number: " thirdNumPrompt: .asciiz "Enter the third number: " sum: .asciiz "\nThe sum of the entered numbers is: " smallestNum: .asciiz "\nThe smallest number is: " largestNum: .asciiz "\nThe largest number is: " initPrompt: .asciiz "Enter 3 whole numbers to display: the largest, the smallest, and the sum\n" tryAgainPrompt: .asciiz "\nWould you like to try again? (Enter any number for no and 0 for yes) " goodbye: .asciiz "\nThank you for using the program, see you next time!" .text main: # Init prompt addi $v0, $0, 4 la $a0, initPrompt syscall # Load 0 into $s1 and $s0 addi $s1, $s1, 0 addi $s0, $s0, 0 while: bgtu $s0, $s1, done # First prompt addi $v0, $0, 4 la $a0, firstNumPrompt syscall # Read the first addi $v0, $0, 5 # system call 5 is for reading an integer syscall # integer value read is in $v0 add $s7, $0, $v0 # copy the width into $8 # Second prompt addi $v0, $0, 4 la $a0, secNumPrompt syscall # Read the second addi $v0, $0, 5 syscall add $s6, $0, $v0 # Third prompt addi $v0, $0, 4 la $a0, thirdNumPrompt syscall # Read the third addi $v0, $0, 5 syscall add $s5, $0, $v0 # Sum prompt addi $v0, $0, 4 la $a0, sum syscall # Add and print sum add $t0, $s7, $s6 add $t0, $t0, $s5 addi $v0, $0, 1 add $a0, $0, $t0 syscall # Smallest prompt addi $v0, $0, 4 la $a0, smallestNum syscall # Find the smallest num bge $s5, $s6, else bge $s5, $s7, elseif add $t1, $0, $s5 b next elseif: add $t1, $0, $s7 b next b next else: bge $s6, $s7, elseifif add $t1, $0, $s6 b next elseifif: add $t1, $0, $s7 b next next: # Print the smallest num addi $v0, $0, 1 add $a0, $0, $t1 syscall # Largest prompt addi $v0, $0, 4 la $a0, largestNum syscall # Find the largest num bge $s7, $s6, newElse bge $s6, $s5, newElseif add $t1, $0, $s5 b newNext newElseif: add $t1, $0, $s6 b newNext b newNext newElse: bge $s7, $s5, newElseifif add $t1, $0, $s5 b newNext newElseifif: add $t1, $0, $s7 b newNext newNext: # Print the smallest num addi $v0, $0, 1 add $a0, $0, $t1 syscall # Prompt to start again addi $v0, $0, 4 la $a0 , tryAgainPrompt syscall # Start again addi $v0, $0, 5 # system call 5 is for reading an integer syscall # integer value read is in $v0 add $s0, $0, $v0 # copy the width into $s0 b while done: # Prompt to start again addi $v0, $0, 4 la $a0 , goodbye syscall exit: ori $v0, $0, 10 # system call code 10 for exit syscall # exit the program