Merge pull request #135 from OskarEn/master

Create GCD.java
This commit is contained in:
Chetan Kaushik 2017-10-03 14:47:19 +05:30 committed by GitHub
commit ae7edb4c08

15
Misc/GCD.java Normal file
View File

@ -0,0 +1,15 @@
//Oskar Enmalm 3/10/17
//This is Euclid's algorithm which is used to find the greatest common denominator
public class GCD{
public static int gcd(int a, int b) {
int r = a % b;
while (r != 0) {
b = r;
r = b % r;
}
return b;
}
}