subject

Greatest common divisor

the greatest common divisor (gcd) of two integers is the largest integer that will evenly divide both integers. the recursive gcd algorithm, described by the following pseudocode: function ged(a, b)
if b=0
return a;
else
return ged(b, a mod b);

write a recursive implementation of euclid's algorithm for finding the greatest common divisor (gcd) of two integers. you can use div instruction to implement your algorithm. it is a single operand is supplied (register or memory operand), which is assumed to be the divisor: div reg/mem32

col1 dividend edx: eax
col2 divisor rm32
col3 quotient eax
col4 remainder edx

first your program prompts the user to enter two positive integers, one after the other. your program will then call the gcd subroutine to find the gcd of the two numbers, and then on return to the calling program it will read the return value and print the result.

example:
enter the first integer: 36
enter the second integer: 60
the gcd of the two numbers is:

your program will consist of two files: • prog4.asm .gcd. asm the prog4.s file will contain code that asks a user for two integers and calls the subroutine which will be located in a separate file (gcd. asm) to get the result and then shows the result to the user. use microsoft's advanced invoke and proto directives to implement your multimodule program.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:50
The instruction ishl (shift left integer) exists in jvm but not in ijvm. it uses the top two values on the stack, replacing the two with a single value, the result. the sec- ond-from-top word of the stack is the operand to be shifted. its content is shifted left by a value between 0 and 31, inclusive, depending on the value of the 5 least signifi- cant bits of the top word on the stack (the other 27 bits of the top word are ignored). zeros are shifted in from the right for as many bits as the shift count. the opcode for ishl is 120 (0x78).a. what is the arithmetic operation equivalent to shifting left with a count of 2? b. extend the microcode to include this instruction as a part of ijv.
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
question
Computers and Technology, 23.06.2019 20:50
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
You know the right answer?
Greatest common divisor

the greatest common divisor (gcd) of two integers is the larges...
Questions
question
History, 27.10.2020 03:50
question
Chemistry, 27.10.2020 04:00