# (Solved Homework): Can someone try to fix this code ?? Thank you….

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

Don't use plagiarized sources. Get Your Custom Essay on
(Solved Homework): Can someone try to fix this code ?? Thank you….
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!

.data
Prompt: .asciiz “How many positive number that is devisable by you want to add? ”
Prompt1: .asciiz “Enter a number: ”
NewLine: .asciiz “n”
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:
la \$a0, Prompt
syscall

syscall

jal PrintNewLine

move \$s0, \$v0
Loop:
la \$a0, Prompt1
syscall

syscall
move \$t0, \$v0
blt \$t0, 0, Lt
bgt \$t0, 100, Gt

Else: div \$t0, \$t6
mfhi \$t1
bne \$t1, 0, No
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:
bne \$s0, 0, Loop

la \$a0, Result
syscall

move \$a0, \$s1
syscall

syscall

PrintError: la \$a0, Error
syscall

move \$a0, \$a2
syscall

move \$a0, \$a3
syscall

jr \$ra

PrintSuccess: move \$a0, \$a2
syscall

la \$a0, Success
syscall

jr \$ra

PrintFail: move \$a0, \$a2
syscall

la \$a0, Fail
syscall

jr \$ra

PrintNewLine: la \$a0, NewLine
syscall
jr \$ra

Show transcribed image text1) 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

I have modified the code with a new code.

.file   1 ""
.section .mdebug.abi32
.previous
.nan    legacy
.module fp=32
.module nooddspreg
.abicalls
.rdata
.align  2
\$LC0:
.ascii  "How many positive number that is devisable by you want t"
.align  2
\$LC1:
.ascii  "%d00"
.align  2
\$LC2:
.ascii  "Enter a number: 00"
.align  2
\$LC3:
.ascii  "%d1200"
.align  2
\$LC4:
.ascii  "****ERROR: %d is not a positive number.Enter another num"
.ascii  "ber00"
.align  2
\$LC5:
.ascii  "****ERROR: %d is not in range of 1 to 100.Enter another "
.ascii  "number00"
.align  2
\$LC6:
.ascii  "Sum is %d00"
.text
.align  2
.globl  main
.set    nomips16
.set    nomicromips
.ent    main
.type   main, @function
main:
.frame  \$fp,48,\$31              # vars= 16, regs= 2/0, args= 16, gp= 8
.set    noreorder
.set    nomacro
sw      \$31,44(\$sp)
sw      \$fp,40(\$sp)
move    \$fp,\$sp
.cprestore      16
movz    \$31,\$31,\$0
sw      \$0,28(\$fp)
lw      \$2,%got(\$LC0)(\$28)
nop
lw      \$2,%call16(puts)(\$28)
nop
move    \$25,\$2
.reloc  1f,R_MIPS_JALR,puts
1:      jalr    \$25
nop

lw      \$28,16(\$fp)
move    \$5,\$2
lw      \$2,%got(\$LC1)(\$28)
nop
lw      \$2,%call16(__isoc99_scanf)(\$28)
nop
move    \$25,\$2
.reloc  1f,R_MIPS_JALR,__isoc99_scanf
1:      jalr    \$25
nop

lw      \$28,16(\$fp)
sw      \$0,24(\$fp)
b       \$L2
nop

\$L7:
lw      \$2,%got(\$LC2)(\$28)
nop
lw      \$2,%call16(printf)(\$28)
nop
move    \$25,\$2
.reloc  1f,R_MIPS_JALR,printf
1:      jalr    \$25
nop

lw      \$28,16(\$fp)
move    \$5,\$2
lw      \$2,%got(\$LC3)(\$28)
nop
lw      \$2,%call16(__isoc99_scanf)(\$28)
nop
move    \$25,\$2
.reloc  1f,R_MIPS_JALR,__isoc99_scanf
1:      jalr    \$25
nop

lw      \$28,16(\$fp)
lw      \$2,36(\$fp)
nop
bgez    \$2,\$L3
nop

lw      \$2,36(\$fp)
nop
move    \$5,\$2
lw      \$2,%got(\$LC4)(\$28)
nop
lw      \$2,%call16(printf)(\$28)
nop
move    \$25,\$2
.reloc  1f,R_MIPS_JALR,printf
1:      jalr    \$25
nop

lw      \$28,16(\$fp)
\$L3:
lw      \$2,36(\$fp)
nop
beq     \$2,\$0,\$L4
nop

lw      \$2,36(\$fp)
nop
slt     \$2,\$2,101
bne     \$2,\$0,\$L5
nop

\$L4:
lw      \$2,36(\$fp)
nop
move    \$5,\$2
lw      \$2,%got(\$LC5)(\$28)
nop
lw      \$2,%call16(printf)(\$28)
nop
move    \$25,\$2
.reloc  1f,R_MIPS_JALR,printf
1:      jalr    \$25
nop

lw      \$28,16(\$fp)
\$L5:
lw      \$2,36(\$fp)
nop
bgtz    \$2,\$L6
nop

lw      \$2,36(\$fp)
nop
slt     \$2,\$2,101
beq     \$2,\$0,\$L7
nop

\$L6:
lw      \$3,36(\$fp)
li      \$2,6                    # 0x6
bne     \$2,\$0,1f
div     \$0,\$3,\$2
break   7
1:
mfhi    \$2
bne     \$2,\$0,\$L8
nop

lw      \$2,36(\$fp)
lw      \$3,28(\$fp)
nop
sw      \$2,28(\$fp)
\$L8:
lw      \$2,24(\$fp)
nop
sw      \$2,24(\$fp)
\$L2:
lw      \$2,32(\$fp)
lw      \$3,24(\$fp)
nop
slt     \$2,\$3,\$2
bne     \$2,\$0,\$L7
nop

lw      \$5,28(\$fp)
lw      \$2,%got(\$LC6)(\$28)
nop
lw      \$2,%call16(printf)(\$28)
nop
move    \$25,\$2
.reloc  1f,R_MIPS_JALR,printf
1:      jalr    \$25
nop

lw      \$28,16(\$fp)
move    \$2,\$0
move    \$sp,\$fp
lw      \$31,44(\$sp)
lw      \$fp,40(\$sp)
j       \$31
nop

.set    macro
.set    reorder
.end    main
.size   main, .-main
.ident  "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609"

Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

## Calculate the price of your order

Total price:
\$0.00

How it works?

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

## Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.