greatest common divisor

!!!Assembly Language x86 only!!! INCLUDE Irvine32.inc with .asm file

Greatest Common Divisor

Write a recursive implementation of Euclid’s algorithm for finding the greatest common divisor (GCD) of two integers.

The Euclidean algorithm:

– Input: Two positive integers, a and b.

– Output: The greatest common divisor, g, of a and b.

– Internal computation

—If a<b, exchange a and b.

—If b=0, report a as the GCD of a and b

—Divide a by b and get the remainder, r. If r=0, report b as the GCD of a and b.

—Replace a by b and replace b by r. Return to the previous step.

Write a test program that calls your GCD procedure five times, using the following pairs of integers: (35,15), (72,18), (31,17), (128,640), (121,0). After each procedure call, display the GCD.

Sample output:


 
Looking for solution of this Assignment?

WHY CHOOSE US?

We deliver quality original papers

Our experts write quality original papers using academic databases.  

Free revisions

We offer our clients multiple free revisions just to ensure you get what you want.

Discounted prices

All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount

100% originality

We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity

On-time delivery

We will deliver your paper on time even on short notice or  short deadline, overnight essay or even an urgent essay