CM fait
This commit is contained in:
15
DEV1.1/CM1/exo1.c
Normal file
15
DEV1.1/CM1/exo1.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
char apostrophe='"';
|
||||
printf(" {o,o}\n");
|
||||
printf(" (__(\\");
|
||||
printf("\n");
|
||||
printf(" -");
|
||||
printf("%c",apostrophe);
|
||||
printf("-");
|
||||
printf("%c",apostrophe);
|
||||
printf("-\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
9
DEV1.1/CM1/exo2.c
Normal file
9
DEV1.1/CM1/exo2.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
printf("%d\n", 57);
|
||||
printf("%o\n", 057);
|
||||
printf("%x\n", 0x57);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
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;
|
||||
}
|
||||
19
DEV1.1/CM1/exo4.c
Normal file
19
DEV1.1/CM1/exo4.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
char lettre_choisi, lettre='a';
|
||||
int alphabet;
|
||||
printf("Entrez une minuscule :");
|
||||
scanf("%c",&lettre_choisi);
|
||||
for (alphabet=0;alphabet<26;alphabet++){
|
||||
if (lettre==lettre_choisi){
|
||||
printf("[%c]",lettre_choisi);
|
||||
} else {
|
||||
printf("%c",lettre);
|
||||
}
|
||||
lettre++;
|
||||
}
|
||||
printf("\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
25
DEV1.1/CM1/exo5.c
Normal file
25
DEV1.1/CM1/exo5.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define NBR_DEE 5
|
||||
|
||||
int main(void) {
|
||||
int score[NBR_DEE];
|
||||
int dee1,dee2=0,occurence,valeur_occurance=7;
|
||||
for (dee1=0;dee1<NBR_DEE;dee1++){
|
||||
printf("Jet n°%d :",dee1);
|
||||
scanf("%d",&score[dee1]);
|
||||
}
|
||||
for (dee1=0;dee1<NBR_DEE;dee1++){
|
||||
for (dee2;dee2<NBR_DEE;dee2++){
|
||||
if (score[dee1]==score[dee2] && score[dee1]!=valeur_occurance){
|
||||
occurence++;
|
||||
}
|
||||
}
|
||||
if (occurence>0){
|
||||
valeur_occurance=score[dee1];
|
||||
}
|
||||
dee2++;
|
||||
}
|
||||
printf("Occurrences maximum : %d\n",occurence);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/felix-vi_CM1.tar.gz
Normal file
BIN
DEV1.1/felix-vi_CM1.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user