MCPcopy Create free account
hub / github.com/E869120/math-algorithm-book / GCD

Method GCD

editorial/chap3-2/prob3-2-2.java:21–35  ·  view source on GitHub ↗
(long A, long B)

Source from the content-addressed store, hash-verified

19 System.out.println(R);
20 }
21 static long GCD(long A, long B) {
22 // 正の整数 A と B の最大公約数を返す関数
23 while (A >= 1 && B >= 1) {
24 if (A < B) {
25 B %= A;
26 }
27 else {
28 A %= B;
29 }
30 }
31 if (A >= 1) {
32 return A;
33 }
34 return B;
35 }
36}

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected