fin de TP06
This commit is contained in:
21
DEV1.1/TP06/division.c
Normal file
21
DEV1.1/TP06/division.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user