Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone try to fix this code ?? Thank you. .data Prompt: .asciiz \"How many

ID: 3883936 • Letter: C

Question

Can someone try to fix this code ?? Thank you.

.data
Prompt: .asciiz "How many positive number that is devisable by you want to add? "
Prompt1: .asciiz "Enter a number: "
NewLine: .asciiz " "
Error: .asciiz "****Error: "
Success: .asciiz " is divisible by 6"
Fail: .asciiz " is not divisible by 6"
RestMessage: .asciiz " is not in the range of 1 to 100."
RestMessage1: .asciiz " is not a positive number"
Result: .asciiz "The Sum of the positive numbers between 1 and 100 that are devisable by 6, is: "
  
.text
Main:  
addi $t6, $zero, 6
la $a0, Prompt
addi $v0, $zero, 4
syscall
  
addi $v0, $zero, 5
syscall
  
jal PrintNewLine
  
move $s0, $v0
addi $s1, $zero, 0
Loop:  
la $a0, Prompt1
addi $v0, $zero, 4
syscall
  
addi $v0, $zero, 5
syscall
move $t0, $v0
blt $t0, 0, Lt
bgt $t0, 100, Gt
  
Else: div $t0, $t6
mfhi $t1
bne $t1, 0, No
Yes: add $s1, $s1, $t0
add $s0, $s0, 1
move $a2, $t0
jal PrintSuccess
jal PrintNewLine
b End
No: move $a2, $t0
jal PrintFail
jal PrintNewLine
End:
b Here
Lt: move $a2, $t0
la $a3, RestMessage1
jal PrintError
jal PrintNewLine
b Here
Gt: move $a2, $t0
la $a3, RestMessage
jal PrintError
jal PrintNewLine
Here:
addi $s0, $s0, -1
bne $s0, 0, Loop
  
la $a0, Result
addi $v0, $zero, 4
syscall

move $a0, $s1
addi $v0, $zero, 1
syscall
  
addi $v0, $zero, 10
syscall
  
PrintError: la $a0, Error
addi $v0, $zero, 4
syscall
  
move $a0, $a2
addi $v0, $zero, 1
syscall
  
move $a0, $a3
addi $v0, $zero, 4
syscall
  
jr $ra
  
PrintSuccess: move $a0, $a2
addi $v0, $zero, 1
syscall
  
la $a0, Success
addi $v0, $zero, 4
syscall
  
jr $ra
  
PrintFail: move $a0, $a2
addi $v0, $zero, 1
syscall
  
la $a0, Fail
addi $v0, $zero, 4
syscall

jr $ra
  
PrintNewLine: la $a0, NewLine
addi $v0, $zero, 4
syscall
jr $ra

1) Write a program that asks user "how many positive number that is devisable by you want to add?”·Then your loop counter would be the user input. If the user enters a positive number between 1 and 100 that is devisable by 6, you increment your loop counter and add it to the sum. You need to decide if the positive number entered by the user is divisible by 6 or not. Your program should print an error message if the number is not within the range and ask user for another number An Example of sample input and output would be How many positive number that is devisable by you want to add? Enter a number: 36 36 is divisible by 6 Enter a number: -20 ****ERROR: -20 is not a positive number. Enter another number Enter a number:0 **ERROR: 0 is not in the range of 1 to 100. Enter another number. Enter a number: 21 21 is not divisible by 6. Enter another number Enter a number: 121 ERROR: 121 is not in the range of 1 to 100, Enter another number. Enter a number:6 6 is divisible by 6 Enter a number: 12 12 is divisible by 6 The Sum of the positive numbers between 1 and 100 that are devisable by 6, is: 54

Explanation / Answer

I have modified the code with a new code.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote