fin de TP06

This commit is contained in:
2023-09-19 17:25:50 +02:00
parent 7ea4eeae0b
commit b831fe17be
10 changed files with 103 additions and 0 deletions

21
DEV1.1/TP06/division.c Normal file
View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int val1,val2,reste,quotient=0,somme=0;
do{
printf("Donnez un entier : \n");
scanf("%d",&val1);
} while (val1<0);
do{
printf("Donnez un deuxieme entier : \n");
scanf("%d",&val2);
} while (val2<=0);
while ((somme+val2)<val1) {
somme+=val2;
quotient+=1;
}
reste=val1-somme;
printf("--> %d =%d x %d + %d \n",val1,quotient,val2,reste);
return EXIT_SUCCESS;
}