DEV/DEV1.1/TP04/monnaie.c

31 lines
414 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void){
double y=0;
printf("montant payer:");
scanf("%lf",&y);
int deux = 0;
int vingt = 0;
int un = 0;
int temp = (int) (y*100);
while(((temp-549)>0)!=0){
temp = temp-549;
}
deux = temp / 200;
temp = temp % 200;
vingt = temp / 20;
temp = temp % 20;
un = temp;
printf("2E = %d\n 20C= %d\n 1C = %d\n",deux,vingt,un);
return EXIT_SUCCESS;
}