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

22 lines
393 B
C
Raw Normal View History

2024-12-09 11:53:11 +01:00
#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;
}