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

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

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

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!
Order Essay

.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:
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

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

Expert Answer

 

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"
        .ascii  "o add? 00"
        .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
        .mask   0xc0000000,-4
        .fmask  0x00000000,0
        .set    noreorder
        .cpload $25
        .set    nomacro
        addiu   $sp,$sp,-48
        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
        addiu   $4,$2,%lo($LC0)
        lw      $2,%call16(puts)($28)
        nop
        move    $25,$2
        .reloc  1f,R_MIPS_JALR,puts
1:      jalr    $25
        nop

        lw      $28,16($fp)
        addiu   $2,$fp,32
        move    $5,$2
        lw      $2,%got($LC1)($28)
        nop
        addiu   $4,$2,%lo($LC1)
        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
        addiu   $4,$2,%lo($LC2)
        lw      $2,%call16(printf)($28)
        nop
        move    $25,$2
        .reloc  1f,R_MIPS_JALR,printf
1:      jalr    $25
        nop

        lw      $28,16($fp)
        addiu   $2,$fp,36
        move    $5,$2
        lw      $2,%got($LC3)($28)
        nop
        addiu   $4,$2,%lo($LC3)
        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
        addiu   $4,$2,%lo($LC4)
        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
        addiu   $4,$2,%lo($LC5)
        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
        addu    $2,$3,$2
        sw      $2,28($fp)
$L8:
        lw      $2,24($fp)
        nop
        addiu   $2,$2,1
        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
        addiu   $4,$2,%lo($LC6)
        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)
        addiu   $sp,$sp,48
        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"

Homework Ocean
Calculate your paper price
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.

Professional and Experienced Academic Writers

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.

24/7 Customer Support

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?

Follow these simple steps to get your paper done

Place your order

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

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

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.

Essays

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.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents