CM fait
This commit is contained in:
32
DEV1.1/CM1/exo3.c
Normal file
32
DEV1.1/CM1/exo3.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user