#include #include <stdlib.h> using namespace std; // Declaration et initialisation de la fonction pgcd int pgcd(int a, int b) { int r,c; while (r!=0) { a/b=c; a%b=r; a=c; b=r; } return (c); } //Debut du program int main(int argc, char *argv[]) { int a,b,pgcd; count << "A?"; cin >> a; count << "B?"; cin >> b; pgcd = pgcd(a,b); cout << "PGCD de " << a << " et de " << b << " est " << pgcd << endl; system("PAUSE"); return 0; }
#include #include <stdlib.h> using namespace std; // Declaration de la fonction pgcd int pgcd(int a, int b); //Debut du program int main(int argc, char *argv[]) { int a,b,pgcd; count << "A?"; cin >> a; count << "B?"; cin >> b; pgcd = pgcd(a,b); cout << "PGCD de " << a << " et de " << b << " est " << pgcd << endl; system("PAUSE"); return 0; } //initialisation de la fonction int pgcd(int a, int b); { int r,c; while (r!=0) { a/b=c; a%b=r; a=c; b=r; } return (c); }
#include #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { int pgcd(int a, int b) { int r,c; while (r!=0) { a/b=c; a%b=r; a=c; b=r; } return (c); } int a,b,pgcd; count << "A?"; cin >> a; count << "B?"; cin >> b; pgcd = pgcd(a,b); cout << "PGCD de " << a << " et de " << b << " est " << pgcd << endl; system("PAUSE"); return 0; }
#include #include <stdlib.h> using namespace std; //Declaration des variables unsigned int a, b; //ou encore long a, b; // Declaration et initialisation de la fonction pgcd int pgcd(int a, int b) { int r,c; while (r!=0) { a/b=c; a%b=r; a=c; b=r; } return (c); } //Debut du program int main(int argc, char *argv[]) { int a,b,pgcd; count << "A?"; cin >> a; count << "B?"; cin >> b; pgcd = pgcd(a,b); cout << "PGCD de " << a << " et de " << b << " est " << pgcd << endl; system("PAUSE"); return 0; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include #include <stdlib.h> using namespace std; int pgcd(int a, int b) { int r,c; while (r!=0) { a/b=c; a%b=r; a=c; b=r; } return (c); } int main(int argc, char *argv[]) { int a,b,pgcd; count << "A?"; cin >> a; count << "B?"; cin >> b; pgcd = pgcd(a,b); cout << "PGCD de " << a << " et de " << b << " est " << pgcd << endl; system("PAUSE"); return 0; }
a/b=c;
count << "A?";