Question

QUESTION 38 Write a program in assembly that adds the sequence of numbers 2,4,6,8,10... etc until...

QUESTION 38

  1. Write a program in assembly that adds the sequence of numbers 2,4,6,8,10... etc until the total is greater than 100.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the code below::

.data
prompt: .asciiz "\n Adding : "
prompt1: .asciiz " Sum now : "

.text

li $t0,2 #seq to be add
li $s0,0 #start with zero

loop:

add $s0,$s0,$t0
li $v0,4
la $a0,prompt #it will print prompt
syscall


li $v0,1
move $a0,$t0
syscall

li $v0,4
la $a0,prompt1 #it will print prompt
syscall


li $v0,1
move $a0,$s0
syscall

add $t0,$t0,2

blt $s0,100, loop

output:

Add a comment
Know the answer?
Add Answer to:
QUESTION 38 Write a program in assembly that adds the sequence of numbers 2,4,6,8,10... etc until...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT