{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

COP3275SN3

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

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

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 http://en.wikipedia.org/wiki/Euclidean_algorithm
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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern