Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

 

Home ] Up ]


 

GCD Program

Contributed by:  Slasher

 

1. The greatest common divider (GCD) of two Integers is the largest Integer that evenly divides each of the two numbers.
2. Write a procedure, named GCD, that returns the greatest common divider of two Integers
3. Incorporate the procedure into a program that reads two values from the user.
4. Write a recursive version of the GCD procedure.  The GCD of x and y is defined recursively as follows:
4.1 If y is equal to 0, then GCD(x,y) is x; otherwise, GCD(x,y) is GCD(y,x Mod y), where Mod is the modulus operator.

 

 

 


All content on this site is free for private use only  |  Contributions are encouraged  |  Thank you to Netfirms for the free hosting  |  If copyright content is published here or links to certain content violates some right/law, contact the Webmaster to have it removed immediately.

 

Site launched: October 2005  |  Updated: July 20, 2006  |  Link exchange  |  Site map  |  Contact us