Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

EuclideanAlgorithm in Java

int recursiveGCD(int a, int b) {
    if (b == 0) {
        return a;
    }
    if (a < b) {
        return recursiveGCD(b, a);
    }
    return recursiveGCD(b, a % b);
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #EuclideanAlgorithm #Java
ADD COMMENT
Topic
Name
2+9 =