Question: Write a program that asks the user to enter the number of even integers that needs to be added together. Then you use the loop

Write a program that asks the user to enter the number of even integers that needs to be added together. Then you use the loop to get the integers from user and add the even numbers together. Finally your program should output the sum on the screen.

NO LONGER NEED HELP... FIGURE IT OUT

I'm using mips simulator. I have an error on code: Won't print out Sum

Write a program that asks the user to enter the number of

even integers that needs to be added together. Then you use the

num: . asciiz "How many even numbers would you like to add together?" SUM: .asciiz "nThe Sum of the number is: .text main: #print num li $v0, 4 la $al, num syscall #input how many even numbers li $v0, 5 syscall li $t6, 0 add $t2, $v0, $0 #loop begin loop: li $50,0 #sum 0 beq $50,$t2, done li $v0, 5 syscall add $t0,$v0,$0 div $t0,$t0,2 mfhi $to beq $t0,0, evenlumber j skip evenlumber: add $t6,$t6, $v0 add $50, $50,1 skip: j loop done: li $v0, 4 la $al, sum syscall add $a0,$t6,90 li $v0,1 exit: li $v0, 10 syscall num: . asciiz "How many even numbers would you like to add together?" SUM: .asciiz "nThe Sum of the number is: .text main: #print num li $v0, 4 la $al, num syscall #input how many even numbers li $v0, 5 syscall li $t6, 0 add $t2, $v0, $0 #loop begin loop: li $50,0 #sum 0 beq $50,$t2, done li $v0, 5 syscall add $t0,$v0,$0 div $t0,$t0,2 mfhi $to beq $t0,0, evenlumber j skip evenlumber: add $t6,$t6, $v0 add $50, $50,1 skip: j loop done: li $v0, 4 la $al, sum syscall add $a0,$t6,90 li $v0,1 exit: li $v0, 10 syscall

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!