Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the code to add rhe two randomly generated numbers aboce and output the following message, where #N1, #N2, and #sum are the first and

Write the code to add rhe two randomly generated numbers aboce and output the following message, where #N1, #N2, and #sum are the first and second random numbers and its respective sum. Confirm the random bumbers and the sum is correct.

;--------------------------------------------

include c:\asmio\asm32.inc

includelib c:\asmio\asm32.lib

includelib c:\asmio\user32.lib

includelib c:\asmio\kernel32.lib


.const

NULL equ 0

min equ 1

max equ 100

.data?

rnumb dword ?

.data

msg1 byte "A random number from ", NULL

msg2 byte " to ", NULL

msg3 byte " is: ", NULL

.code

main proc


call Randomize

call Random32

call writeDec

call crlf

move eax, max

call RandomRange

add eax, min

call WriteDec

call crlf

mov edx, OFFSET msg1

call WriteString

mov eax, min

call WriteDec

mov edx, OFFSET msg2

call WriteString

mov eax, max

call WriteDec

mov edx, OFFSET msg3

call WriteString

ret 0


main endp

end main

;-------------------------------- image text in transcribed
Note: The procedure named randomize on line 30 must be called prior to using the other generators. It is required to initialize the seed just as in CH. It is done only once in any program. 3. You may type my program to see how it works and when it's done change the program so that it generates two random numbers satisfying the following conditions: a) The first number, N1 ranging from 17 62 and store it in a variable named number1 b) The second number, N2 ranging from 23 - 28 and store it in a variable named number2 4. Using the previous labs write the code to add the two randomly generated numbers above and output the following message, where #N1, #N2, and #sum are the first and second random numbers and its respective sum. Confirm the random numbers and the sum is Correct. The sum of #Ni and #N2 is: #sum

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions