COP3275SN3 - Here is the pseudo code for Euclidean...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3275 C Language Special Notes #3 Details about Euclidean Algorithm Euclidean Algorithm is used to compute the greatest common divisor (GCD) of two positive integers. The process is like this: Let and ± be the two numbers, and ² ³´ ²± . Compute the remainder when is divided by ± . Copy ± into and copy the remainder into ± . If ± is 0, then stop and contains the GCD. Otherwise, repeat this process. For more details, please refer to
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Here is the pseudo code for Euclidean Algorithm: 1. Initialize integer m and n 2. Do: m / n , and save remainder 3. Do: m = n, n = remainder 4. If n = 0, end and return m as the GCD 5. Else: repeat step 2 ~ 4 Once you calculated the GCD, divide the numerator and denominator of the original fraction by their GCD, and this will give you the lowest term of the fraction. Yi Wang, Radhika Medury...
View Full Document

This note was uploaded on 11/30/2011 for the course COP 3275 taught by Professor Jonathanliu during the Fall '11 term at University of Florida.

Ask a homework question - tutors are online