Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- .text
- # 1000/3 = 333 , 1000/5 = 200
- li $t0, 0 # This is my total sum
- li $t1, 1 # This is my counter
- multiple_of_Three:
- bgt $t1, 333, Reset_Values # If $t1 > 333 --> Reset_Values
- mul $t2, $t1, 3 # This finds my multiple t2 = 3 * counter
- add $t0, $t0, $t2 # This sums my new multiple with previous ones
- addi $t1, $t1, 1 # Increment Counter
- j multiple_of_Three
- Reset_Values:
- move $s0, $t0 #Save my previous sum of three multipeles
- li $t0, 0 # This is my total sum
- li $t1, 1 # This is my counter
- multiple_of_Five:
- bgt $t1, 199, end # If $t1 > 200 --> End
- mul $t2, $t1, 5 # This finds my multiple t2 = 5 * counter
- add $t0, $t0, $t2 # This sums my new multiple with previous ones
- addi $t1, $t1, 1 # Increment Counter
- j multiple_of_Five
- end:
- add $s0, $s0, $t0
- subi $s0, $s0, 33165
- li $v0, 1
- move $a0, $s0
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement