47 lines
798 B
C
47 lines
798 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
int main(void){
|
||
|
int argent;
|
||
|
int livre = 0;
|
||
|
int deniers = 0;
|
||
|
int sous = 0;
|
||
|
printf("Combien de deniers ? \n");
|
||
|
scanf("%d", &argent);
|
||
|
while (argent >= 240){
|
||
|
livre++;
|
||
|
argent = argent-240;
|
||
|
}
|
||
|
while (argent >=12){
|
||
|
sous++;
|
||
|
argent = argent-12;
|
||
|
}
|
||
|
while (argent >= 1){
|
||
|
deniers++;
|
||
|
argent = argent-1;
|
||
|
}
|
||
|
if(livre != 0 && livre == 1){
|
||
|
printf("%d", livre);
|
||
|
printf(" livre\n");
|
||
|
}
|
||
|
if(livre > 1){
|
||
|
printf("%d", livre);
|
||
|
printf(" livres\n");
|
||
|
}
|
||
|
if(sous != 0 && sous == 1){
|
||
|
printf("%d", sous);
|
||
|
printf(" sou\n");
|
||
|
}
|
||
|
if(sous > 1){
|
||
|
printf("%d", sous);
|
||
|
printf(" sous\n");
|
||
|
}
|
||
|
if(deniers != 0 && deniers == 1){
|
||
|
printf("%d", deniers);
|
||
|
printf(" denier");
|
||
|
}
|
||
|
if(deniers > 1){
|
||
|
printf("%d", deniers);
|
||
|
printf(" deniers");
|
||
|
}
|
||
|
return 0;
|
||
|
}
|