44 lines
830 B
C
44 lines
830 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include<math.h>
|
||
|
|
||
|
#define POUCE 2.56
|
||
|
#define PIED 30.72
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
int pieds = 0, pouces = 0;
|
||
|
double taille;
|
||
|
|
||
|
printf("Veuillez indiquer votre taille : ");
|
||
|
scanf("%lf", &taille);
|
||
|
|
||
|
taille *= 100;
|
||
|
taille = (double)lround(taille);
|
||
|
|
||
|
while (taille >= PIED) {
|
||
|
taille -= PIED;
|
||
|
pieds++;
|
||
|
}
|
||
|
|
||
|
while (taille >= POUCE) {
|
||
|
taille -= POUCE;
|
||
|
pouces++;
|
||
|
}
|
||
|
|
||
|
|
||
|
if (pieds > 0) {
|
||
|
if (pouces > 0) {
|
||
|
printf("Vous faites %d pied%s et %d pouce%s\n", pieds, pieds > 1 ? "s" : "",
|
||
|
pouces, pouces > 1 ? "s" : "");
|
||
|
} else {
|
||
|
printf("Vous faites %d pied%s\n", pieds, pieds > 1 ? "s" : "");
|
||
|
}
|
||
|
|
||
|
} else if (pouces > 0) {
|
||
|
printf("Vous faites %d pouce%s\n", pouces, pouces > 1 ? "s" : "");
|
||
|
} else printf("Vous faites moins d'un pouce !\n");
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|