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

Function GCD

codes/cpp/Code_3_02_1.cpp:3–9  ·  view source on GitHub ↗

���̐��� A �� B �̍ő���񐔂�Ԃ��֐� GCD �� Greatest Common Divisor�i�ő���񐔁j�̗�

Source from the content-addressed store, hash-verified

1// ���̐��� A �� B �̍ő���񐔂�Ԃ��֐�
2// GCD �� Greatest Common Divisor�i�ő���񐔁j�̗�
3long long GCD(long long A, long long B) {
4 long long Answer = 0;
5 for (long long i = 1; i <= min(A, B); i++) {
6 if (A % i == 0 && B % i == 0) Answer = i;
7 }
8 return Answer;
9}

Callers

nothing calls this directly

Calls 1

minFunction · 0.85

Tested by

no test coverage detected