// https://www.geeksforgeeks.org/euclidean-algorithms-basic-and-extended/ // PGCD de deux nombres entiers #include using namespace std; // Function to return gcd of a and b int gcd(const int a, const int b) { if(a == 0) return b; return gcd(b % a, a); // appel récursif } // gcd() int main() { int a = 10, b = 15; cout << "GCD(" << a << ", " << b << ") = " << gcd(a, b) << '\n'; a = 35, b = 10; cout << "GCD(" << a << ", " << b << ") = " << gcd(a, b) << '\n'; a = 31, b = 2; cout << "GCD(" << a << ", " << b << ") = " << gcd(a, b) << '\n'; return 0; } // main()