- #pragma hdrstop
-
- #pragma argsused
-
- #include <conio.h>
- #include <iomanip.h>
- #include <iostream.h>
-
- int pgcd(int a, int b) ;
-
- void main(void)
- {
- int nb1, nb2 ;
- int ret ;
-
- cout << "entrez le 1er nombre : " ;
- cin >> nb1 ;
-
- cout << endl << "entrez le 2eme nombre : " ;
- cin >> nb2 ;
-
- ret = pgcd(nb1, nb2) ;
-
- cout << endl << "le pgcd de " << nb1 << " et " << nb2 << " est : " << ret ;
-
- cout << endl << endl << "appuyer sur une touche pour terminer..." ;
- getch() ;
- }
- //---------------------------------------------------------------------------
-
- int pgcd(int a, int b)
- {
- if (a % b == 0)
- return b ;
-
- return pgcd(b, a % b) ;
- }
#pragma hdrstop
#pragma argsused
#include <conio.h>
#include <iomanip.h>
#include <iostream.h>
int pgcd(int a, int b) ;
void main(void)
{
int nb1, nb2 ;
int ret ;
cout << "entrez le 1er nombre : " ;
cin >> nb1 ;
cout << endl << "entrez le 2eme nombre : " ;
cin >> nb2 ;
ret = pgcd(nb1, nb2) ;
cout << endl << "le pgcd de " << nb1 << " et " << nb2 << " est : " << ret ;
cout << endl << endl << "appuyer sur une touche pour terminer..." ;
getch() ;
}
//---------------------------------------------------------------------------
int pgcd(int a, int b)
{
if (a % b == 0)
return b ;
return pgcd(b, a % b) ;
}