Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

euclids algoritm java gcd

//Calculating GCD with euclid's algorithm using recursion

public static int calcGCD(int num1, int num2) {
		if (num2 == 0) {
			return num1;
		} else {
			return calcGCD(num2, num1 % num2);
		}
	}
 
PREVIOUS NEXT
Tagged: #euclids #algoritm #java #gcd
ADD COMMENT
Topic
Name
1+9 =