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

Write a program in assembly that calculates the sum of all the numbers of a floa

ID: 3926864 • Letter: W

Question

Write a program in assembly that calculates the sum of all the numbers of a floating point array that are bigger than the user input. Assume you defined an array with 10 floating point elements in your program and you ask the user for a real number. The result will be shown in the output with an appropriate message. If there are no bigger numbers than the user input in your array provide an appropriate message.

Use array A=[1.35 2.67 3.566 4.56 5.98 9.43 12.34 15.54 23.87 34.33 ] as the floating point array.

For example:

Please give a real number:

16.75

The answer is:

58.2

Assembly code must be able to run in QtSpim.

Explanation / Answer

section.text

     global_start

_start :

   mov eax, 10     
   mov ebx, 2
   mov ecx, num

li:                              // Loop Declaration in the Assembly

    jg db    // check the number greater than each array element.

    mov [sum], db

loop li

display:

section .data    

userMsg db 'Please give a real number '

lenUserMsg equ $-userMsg               ;The length of the message
global x

        db 4.56

db    5.98

        db    9.43

        db    12.34

        db    15.54

        db    23.87

        db     34.33

userAns db 'The Answer Is: '

                           

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