Files
DEV/DEV1.1/CM1/exo3.c

32 lines
754 B
C
Raw Permalink Normal View History

2023-10-24 15:42:53 +02:00
#include <stdio.h>
#include <stdlib.h>
int main(void) {
double taille;
int pouce, pouces,pied, pieds;
printf("Entrez votre taille :");
scanf("%lf",&taille);
taille*=100;
if ((taille/2.56)>1){
pouces=taille/2.56;
if ((pouces/12)>1){
pieds=pouces/12;
pouces-=pieds*12;
printf("%d pieds et %d pouces\n",pieds,pouces);
} else if ((pouces/12)>1 && (pouces-(pouces/12)==1)){
pieds=pouces/12;
pouces-=pieds*12;
printf("%d pieds et %d pouce\n",pieds,pouces);
} else if ((pouces/12)==1){
pied=pouces/12;
pouces-=pieds*12;
printf("%d pied et %d pouce\n",pied,pouces);
} else{
printf("%d pouces\n",pouces);
}
} else{
pouce=taille/2.56;
printf("%d pouce\n",pouce);
}
return EXIT_SUCCESS;
}