Answered step by step
Verified Expert Solution
Question
1 Approved Answer
.data str1: .asciiz How many even numbers would you like to add together? str2: .asciiz The sum of the numbers is .text main:
.data str1: .asciiz "How many even numbers would you like to add together? " str2: .asciiz "The sum of the numbers is " .text main: li $v0, 4 #print str1 la $a0, str1 syscall li $v0, 5 #Input how many even numbers want to be taken syscall add $t7, $0, $v0 bgt $t7, $0, loop j main loop: beq $t7, $0, done li $v0, 5 syscall move $t0,$v0 div $t0,$2 mfhi $t0 beq $t0,0,evenNumber j skip evenNumber: add $t6,$t6,$v0 addi $s0,$s0,1 skip: j loop done: li $v0, 4 #print str2 la $a0, str2 syscall move $a0,$t6 li $v0,1 syscall exit: li $v0, 10 syscall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started