Okay I am trying to create a program that takes in 10 integers, then prints out the Max integer and the Min integer. The first loop reads in the 10 integers and the second one is supposed to print out the Max and Min integers. The problem I'm having is that its just not printing out the max or min integers, it seems to be reading in the integers just fine however. Any help is greatly appreciated.

#Prompts user for 8 numbers and outputs
#the maximum and minimum value
	   .data              #Data for the program
     prompt_msg: .asciiz "Please input 10 numbers\n"
     prompt: .asciiz "Input number "
     new_line: .asciiz "\n"

     li $t1, 0                #store 0 into $t0
     li $t2, 10                #store 10 into $t1

     la $a0, prompt_msg       #load the address of the prompt_msg into $a0
     li $v0, 4                #code 4 to print the string using syscall
     syscall                  #do the syscall(prints the message)

         Loop:                    #loops 10 times prompting the user for number
         la $a0, prompt           #prompts the user for the current input number
         li $v0, 4                #prints the message
         syscall                  #calls the message

	 li $v0, 5
	 addi $sp, $sp, -4  
	 sw $v0, ($sp)
	 move $a0, $v0

         li $v0, 1                #code 1 to $v0 means print integer
         syscall                  #calls syscall(prints message)

         la $a0, new_line         #calls the code for new line
         li $v0, 4                #code 4 to print out string
         syscall                  #prints out new line

                                  #need code to store each input into an array
                                 #and store them in incrementing cells\

         add $t1, $t1, 1          #add 1 to the current value of $t0
         bne $t1, $t2, Loop       #if $t0 != 10, continue loop

        li $t1, 0                #store 0 into $t0
	li $t2, 10                #store 10 into $t1
		# Print out the result
	lw	$t3,	36($sp)
	addi	$sp,	$sp,	4
	move	$a0,	$t3
	li	$v0,	1
	add $t1, $t1, 1          #add 1 to the current value of $t0
        bne $t1, $t2, Loop       #if $t0 != 10, continue loop

     li $v0, 10               #code 10 to exit
     syscall                  #do the syscall, exits

is there any information that I can further provide to gain help with this problem?(BTW I couldn't find the edit post option so thats why I am posting a reply)

This article has been dead for over six months. Start a new discussion instead.