Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

(f) Prove that for any non-negative integer n 2 4, 3" s (n+1)

Answered: 1 week ago

Question

Describe sexual harassment in the global environment.

Answered: 1 week ago