Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the Error in this code why it's not running? Please use Irvine library ; Programming 6 INCLUDE Irvine32.inc .data str1 BYTE Please input

What is the Error in this code why it's not running?

Please use Irvine library

; Programming 6 INCLUDE Irvine32.inc

.data

str1 BYTE "Please input first numbers : ", 0 str2 BYTE "Please input second numbers : ", 0 str3 BYTE "Please input third numbers : ", 0 str4 BYTE "Please input fourth numbers : ", 0 str5 BYTE "The smallest number is :", 0 str6 BYTE "The largest number is :",0 str7 BYTE "The summation of the numbers is ", 0 str8 BYTE "+",0 str9 BYTE "=",0 number dword 4 dup (?) smallest dword ? largest dword ? sum dword ?

.code main PROC ; get input data from keyboard mov esi, OFFSET number ; get first number mov edx, OFFSET str1 call WriteString call ReadDec mov [esi], eax call Crlf

; get second number add esi, 4 mov edx, OFFSET str2 call WriteString call ReadDec mov [esi], eax call Crlf

; get third number add esi, 4 mov edx, OFFSET str3 call WriteString call ReadDec mov [esi], eax call Crlf

; get forth number add esi, 4 mov edx, OFFSET str4 call WriteString call ReadDec mov [esi], eax call Crlf

; to find the smallest mov esi, OFFSET number mov ax, [esi] mov ecx, 3

next1: add esi, 4 cmp ax, [esi] jle next2 mov ax, [esi]

next2: loop next1 mov smallest, eax

; to find the largest number ; mov esi, OFFSET number mov ax, [esi] mov ecx, 3

next4: add esi, 4 cmp eax, [esi] jge next3 mov ax, [esi]

next3: loop next4 mov largest, eax

; to find the summation of the numbers ; mov esi, OFFSET number mov ax, [esi] mov ecx, 3

next5: add esi, 4 add ax, [esi] loop next5 mov sum, eax

; to display the answers ; mov edx, OFFSET str5 call WriteString mov eax, smallest call WriteDec call Crlf

mov edx, OFFSET str6 call WriteString mov eax, largest call WriteDec call Crlf

mov edx, OFFSET str7 call WriteString

mov esi, OFFSET number mov ecx, 3 mov eax, [esi] call WriteDec

next6: mov edx, OFFSET str8 call WriteString add esi, 4 mov eax, [esi] call WriteDec

loop next6 mov edx, OFFSET str9 call WriteString mov eax, sum call WriteDec call Crlf

exit main ENDP END main

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