8000 GitHub - taylorericson/lab-08-GCD-recursion: Lab 8 - GCD Recursion
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

taylorericson/lab-08-GCD-recursion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lab-08-GCD-recursion

CSC 240 - Lab 8 GCD Recursion

A project completed as part of the class CSC 240 at Parkland College.

Directions:

Design a program that implements Euclid’s algorithm for finding the greatest common divisor (also known as greatest common factor, highest common divisor, or highest common factor) of two positive integers. The greatest common divisor is the largest integer that divides both values without producing a remainder. An iterative version of this method was part of the RationalNumber class in Chapter 7.4 of the textbook. Write a RationalNumber class containing a numerator and denominator as its fields. Write a recursive method (named gcd) that computes and returns the greatest common divisor of the numerator and denominator. Write a driver that prompts the user for a numerator and denominator, creates a RationalNumber object and computes and prints the greatest common denominator using the recursive gcd method as shown below.

Enter positive integer as numerator: 108

Enter positive integer as denominator: 144

Greatest common denominator of 108/144 is 36

About

Lab 8 - GCD Recursion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0