// Test.cpp// Le plus grand et le plus petit diviseur commun.#include <iostream>using namespace std;void ppcd( int, int ); // Prototype de la Fonction ppcd (plus petit diviseurs commun ).void ppcd( int x, int y ){ if( x > y ) for( int n = 2; n <= ( x / 2 ); n++ ) if( ( ( x % n ) == 0 ) && ( ( y % n ) == 0 ) && ( ( y % n ) == ( x % n ) ) ) { cout<<"Le plus petit diviseur commun ormis le 1 est: "<<n<< endl; break; } else if( x < y ) for( int n = 2; n <= ( y / 2 ); n++ ) if( ( ( x % n ) == 0 ) && ( ( y % n ) == 0 ) && ( ( y % n ) == ( x % n ) ) ) { cout<<"Le plus petit diviseur commun ormis le 1 est: "<<n<< endl; break; } else if( x == y ) for( int n = 2; n <= ( x / 2 ); n++ ) if( ( x % n ) == 0 ) { cout<<"Le plus petit diviseur commun ormis le 1 est: "<<n<<endl; break; } }void pgcd( int, int ); // Prototype de la Fonction pgcd ( plus grand diviseur commun ).void pgcd( int x, int y ){ if( x > y ) for( int n = x / 2; n >= 1; n-- ) if( ( ( x % n ) == 0 ) && ( ( y % n ) == 0 ) && ( ( x % n ) == ( y % n ) ) ) { cout<<"Le plus grand diviseur commun de ses deux entiers est: "<<n<<endl; break; } else if( x < y ) for( int n = y / 2; n >= 1; n-- ) if( ( ( x % n ) == 0 ) && ( ( y % n ) == 0 ) && ( ( y % n ) == ( x % n ) ) ) { cout<<"Le plus grand diviseur commun de ses deux entiers est: "<<n<<endl; break; } else if( x == y ) for( int n = x / 2; n >= 1; n-- ) if( ( x % n == 0 ) ) { cout<<"Le plus grand diviseur commun des ses deux entiers égaux est: "<<n<<endl; break; }}int main(){ int a, b; cout<<"Entrer deux entiers positifs svp: "<<endl; cin>>a>>b; ppcd( a, b ); pgcd( a, b ); return 0;}