20 lines
386 B
C
20 lines
386 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
|
||
|
int pgcd(int a, int b) {
|
||
|
if (b == 0) return a;
|
||
|
else if (a == 0) return b;
|
||
|
else {
|
||
|
return pgcd(b, a % b);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
|
||
|
int v1, v2;
|
||
|
printf("Veuillez donner deux entiers : ");
|
||
|
scanf("%d %d", &v1, &v2);
|
||
|
|
||
|
printf("Le plus grand diviseur commun entre %d et %d est %d\n", v1, v2, pgcd(v1, v2));
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|