Developpement/23DEV1.1/CM1/Exo3.c

29 lines
569 B
C
Raw Normal View History

2024-12-09 11:53:11 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void) {
double taille;
double pouce;
int poucei;
double pieds;
int piedsi;
printf("Entrez votre taille : ");
scanf("%lf", &taille);
pouce = trunc(taille*100.0)/2.56;
poucei = floor(pouce);
poucei = poucei % 12;
pieds = ceil(round(pouce / 12));
piedsi = pieds;
if(piedsi > 1){
printf("%d pieds, ", piedsi);
}else{
printf("%d pied, ", piedsi);
}
if(poucei > 1){
printf("%d pouces\n", poucei);
}else{
printf("%d pouce\n", poucei);
}
return EXIT_SUCCESS;
}