Developpement/23DEV1.1/TPS1/TP01/07-Boucles/BouclesBis/BoucleBisbis/Diviseur.c

22 lines
393 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void) {
int max = 0;
int n;
int ns;
printf("Entrez un entier : ");
scanf("%d", &n);
printf("Entrez un second entier : ");
scanf("%d", &ns);
if (ns == 0){
printf("pgcd(%d, %d) = %d", n, ns, n);
}else{
while (ns > 0){
printf("%d = %d X %d + %d", n, ns, n/ns, n%ns);
n = ns;
ns = n%ns;
r = n;
}
}
return EXIT_SUCCESS;
}