Question: Assembly language I have this code but there is an error because when i insert a numberit always gives me the same GDC Here is

Assembly language

I have this code but there is an error because when i insert a numberit always gives me the same GDC

Here is the code:

TITLE Greatest Common Divisor (gdc.asm) INCLUDE Irvine32.inc .data str1 BYTE "Enter two integers: ",0 str2 BYTE "The GDC is: ",0 firstNo SDWORD ? secondNo SDWORD ? rem DWORD ? .code main PROC call Clrscr mov ecx,5 Label1: call InputIntegers call GDC call Display loop Label1 exit main ENDP InputIntegers PROC USES eax edx mov edx, OFFSET str1 call WriteString call ReadInt mov firstNo,eax call ReadInt mov secondNo,eax call Crlf ret InputIntegers ENDP GDC PROC USES eax ebx edx mov eax,firstNo mov ebx,eax sar ebx,31 add eax,ebx xor eax,ebx mov firstNo,eax mov eax,secondNo mov ebx,eax sar ebx,31 add eax,ebx xor eax,ebx mov secondNo,eax Label1: mov eax,firstNo mov edx,0 mov ebx,secondNo div ebx mov rem,edx mov eax,ebx mov ebx,rem cmp secondNo,0 jb Label2 loop Label1 Label2: mov eax,firstNo ret GDC ENDP Display PROC USES edx mov edx, OFFSET str2 call WriteString call WriteDec call Crlf call Crlf ret Display ENDP END main

Here is the output with the problem circle in red

Assembly language I have this code but there is an error because

CAWINDOWSAsystem321cmd.exe ab88, exe Enter two integer s 33 24 The GDC is 259225307 Enter two integers 12 20 he GDO is 259225307 Enter two integers: 71 19 he GDC is 5922530

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!