advertisement

Find Code  Advanced Search   

browse free vb code
Submit Code
ASP,  HTML, and XML
Database
Dates  and Math
Files  and Directories
Forms  and Controls
Lists,  Collections, and Arrays
Miscellaneous
Multimedia/Games
Office/VBA
Network/Internet
Registry
Screen/Graphics
String  Manipulation
System/API
Windows  2000/XP
VB.NET/ASP.NET



advertisement
Find The Greatest Common Divisor of Two Integers Using Euclid's Algorithm

Author: Jay
Category: Dates and Math
Type: Snippets
Difficulty: Intermediate

Version Compatibility:  Visual Basic 5   Visual Basic 6

More information: This function computes the GCD (Greatest Common Divisor) of any two integers, negative or positive, up to 28 digits long. The method used is based on an ancient algorithm devised by Euclid. Euclid was a Greek geometer of the 3d century b.c., famous for his treatise on geometry. Many of his logical concepts are still being studied and applied in mathematics today. This function is one of those concepts in action.

The GCD is simply the largest positive integer that will perfectly divide any two integer values in common. The signs of the integers are ignored and the GCD is always expressed as a positive value. In integer fractional arithmetic, the GCD may be used to reduce a fraction to its lowest terms by dividing both the numerator and the denominator of the fraction by this GCD. This produces the smallest integer fraction that has the same identical numerical ratio.

More information regarding the function and its usage can be found in the included readme file and the code's comments.

This code has been viewed 49730 times.

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

code/GCD.zip

Sponsored Links


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers