DEV_BUT1/DEV1.1/TP04/division.c

25 lines
455 B
C
Raw Normal View History

2022-10-18 14:50:36 +02:00
#include <stdio.h>
#include <stdlib.h>
int main(void){
int val1;
int val2;
int quo;
int reste;
printf("Donnez un nombre entier");
scanf("%d\n", & val1);
printf("Donnez un nombre entier");
scanf("%d\n", & val2);
int i;
for (i = val2; i<=val1; i=i+val2){
quo = quo + 1;
}
reste = val1-i;
printf("%d", val1);
printf(" = ");
printf("%d", val2);
printf(" x ");
printf("%d", quo);
printf(" + ");
printf("%d", reste);
return EXIT_SUCCESS;
}