diff --git a/DEV1.1/CONTROLE/controle.c b/DEV1.1/CONTROLE/controle.c new file mode 100644 index 0000000..86ef8a8 --- /dev/null +++ b/DEV1.1/CONTROLE/controle.c @@ -0,0 +1,8 @@ +#include +#include +int main(void){ + printf("{o,o}\n"); + printf("(__(\\\n"); + printf("-\"-\"-"); + return 0; +} \ No newline at end of file diff --git a/DEV1.1/CONTROLE/distribution.c b/DEV1.1/CONTROLE/distribution.c new file mode 100644 index 0000000..e506fb9 --- /dev/null +++ b/DEV1.1/CONTROLE/distribution.c @@ -0,0 +1,3 @@ +#include +#include +int main(void) \ No newline at end of file diff --git a/DEV1.1/CONTROLE/histogramme.c b/DEV1.1/CONTROLE/histogramme.c new file mode 100644 index 0000000..9767781 --- /dev/null +++ b/DEV1.1/CONTROLE/histogramme.c @@ -0,0 +1,16 @@ +#include +#include +int main(void){ + int tab[20] = {8,12,14,3,1,5}; + int l = 6; + int i; + int a; + for(i = 0; i < l; i++){ + for(a=0; a< tab[i]; a++){ + printf("▄ "); + } + printf("\n"); + } + return 0; +} + \ No newline at end of file diff --git a/DEV1.1/CONTROLE/parite.c b/DEV1.1/CONTROLE/parite.c new file mode 100644 index 0000000..8dd174c --- /dev/null +++ b/DEV1.1/CONTROLE/parite.c @@ -0,0 +1,16 @@ +#include +#include +int main(void){ + int ent1; + int ent2; + printf("Donnez un entier : "); + scanf("%d\n", &ent1); + printf("Donnez un entier : "); + scanf("%d\n", &ent2); + if (ent1%2 == 0 || ent2%2 == 0){ + printf("Pair"); + } + else + printf("Impair"); + return 0; +} \ No newline at end of file diff --git a/DEV1.1/CONTROLE/triage.c b/DEV1.1/CONTROLE/triage.c new file mode 100644 index 0000000..c6b6bfc --- /dev/null +++ b/DEV1.1/CONTROLE/triage.c @@ -0,0 +1,13 @@ +#include +#include +int main(void){ + double a = 2.0; + int b = 02; + char c = (char) '\x32'; + long int d = 2L; + printf("%.0lf\n", a); + printf("%d\n", b); + printf("%c\n", c); + printf("%ld\n", d); + return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP04/Table.c b/DEV1.1/TP04/Table.c new file mode 100644 index 0000000..6471354 --- /dev/null +++ b/DEV1.1/TP04/Table.c @@ -0,0 +1,20 @@ +#include +#include +int main(void){ + int ent1; + printf("entrez un entier : "); + scanf("%d", & ent1); + int i; + int res; + for(i = 1; i<11; i = i+1){ + res = i*ent1; + printf("%d", ent1); + printf(" x "); + printf("%d", i); + printf(" = "); + printf("%d\n", res); + } + return EXIT_SUCCESS; +} + + \ No newline at end of file diff --git a/DEV1.1/TP04/division.c b/DEV1.1/TP04/division.c new file mode 100644 index 0000000..336ed10 --- /dev/null +++ b/DEV1.1/TP04/division.c @@ -0,0 +1,25 @@ +#include +#include +int main(void){ + int val1; + int val2; + int quo; + int reste; + printf("Donnez un nombre entier"); + scanf("%d\n", & val1); + printf("Donnez un nombre entier"); + scanf("%d\n", & val2); + int i; + for (i = val2; i<=val1; i=i+val2){ + quo = quo + 1; + } + reste = val1-i; + printf("%d", val1); + printf(" = "); + printf("%d", val2); + printf(" x "); + printf("%d", quo); + printf(" + "); + printf("%d", reste); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP04/ordrecroissant.c b/DEV1.1/TP04/ordrecroissant.c new file mode 100644 index 0000000..8c63757 --- /dev/null +++ b/DEV1.1/TP04/ordrecroissant.c @@ -0,0 +1,31 @@ +#include +#include +int main(void) { +int val1; +int val2; +int val3; +do { + printf("Donnez une valeur1 :"); + scanf("%d", &val1); + printf("Donnez une valeur2 :"); + scanf("%d", &val2); + printf("Donnez une valeur3 :"); + scanf("%d", &val3); +} while (val1<10 || val1>20 || val2<10 || val2>20 ||val3<10 || val3>20); +if (val1 > val2 && val2 > val3 && val1 > val3) + printf("%d %d %d\n", val3, val2, val1); +if (val3 > val2 && val2 > val1 && val3 > val1); + printf("%d %d %d\n", val1, val2, val3); +if (val2 > val1 && val1 > val3 && val2 > val3); + printf("%d %d %d\n", val3, val1, val2); +if (val1 > val3 && val3 > val2 && val1 > val2); + printf("%d %d %d\n", val2, val3, val1); +if (val3 > val1 && val1 > val2 && val3 > val2); + printf("%d %d %d\n", val2, val1, val3); +if (val2 > val3 && val3 > val1 && val2 > val1); + printf("%d %d %d\n", val1, val3, val2); +return EXIT_SUCCESS; +} + + + diff --git a/DEV1.1/TP04/sequence.c b/DEV1.1/TP04/sequence.c new file mode 100644 index 0000000..2d30055 --- /dev/null +++ b/DEV1.1/TP04/sequence.c @@ -0,0 +1,15 @@ +#include +#include +int main(void){ + int val1; + int val2; + printf("Choisir la valeur 1"); + scanf("%d", & val1); + printf("Choisir la valeur 2"); + scanf("%d", & val2); + int i; + for(i = val1; i< val2+1; i = i+1){ + printf("%d\n", i); + } + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP05/alltype.c b/DEV1.1/TP05/alltype.c new file mode 100644 index 0000000..646c0eb --- /dev/null +++ b/DEV1.1/TP05/alltype.c @@ -0,0 +1,17 @@ +#include +#include + +int main(void){ + printf("%hhd", 77); + printf("%hhu", 77); + printf("%hd", 77); + printf("%hu", 77); + printf("%d", 77); + printf("%u", 77); + printf("%ld", 77); + printf("%lu", 77); + printf("%lld", 77); + printf("%llu", 77); + printf("%f", 77); + printf("%lf", 77); + printf("%Lf", \ No newline at end of file diff --git a/DEV1.1/TP05/devinette.c b/DEV1.1/TP05/devinette.c new file mode 100644 index 0000000..251898a --- /dev/null +++ b/DEV1.1/TP05/devinette.c @@ -0,0 +1,30 @@ +#include +#include + +int main(void){ + int val = rand()%100; + int essai; + int TRY_MAX = 5; + int i; + int reussi=0; + printf("%d", val); + while (essai != val){ + printf("DOnnez un chiffre : \n"); + scanf("%d", & essai); + if (essai==val){ + printf("Vous avez réussi ! \n"); + printf("%d", val); + } + if (essai < val){ + printf("VOus etes en dessous de la valeur : \n"); + } + if (essai > val){ + printf("Vous êtes au dessus de la valeur : \n"); + } + } + return EXIT_SUCCESS; +} + + + + diff --git a/DEV1.1/TP05/fibo.c b/DEV1.1/TP05/fibo.c new file mode 100644 index 0000000..dfa630b --- /dev/null +++ b/DEV1.1/TP05/fibo.c @@ -0,0 +1,19 @@ +#include +#include + +int main(void){ + int a=0; + int b=1; + int n; + int i; + int e; + printf("Donne une valeur :"); + scanf("%d", &n); + for(i = 0; i +#include + +int main(void){ + int nbpr; + int compteur=0; + int i; + printf("DOnnez un entier \n"); + scanf("%d", &nbpr); + for(i = 2; i <= nbpr; i= i+1){ + if ((nbpr%i)==0) + compteur ++; + } + if (compteur > 1){ + printf("nombre non premier \n"); + } + if (compteur == 1){ + printf("nombre premier \n"); + } + printf("%d\n", compteur); + return EXIT_SUCCESS; +} + + + \ No newline at end of file diff --git a/DEV1.1/TP05/sapin.c b/DEV1.1/TP05/sapin.c new file mode 100644 index 0000000..ee5d0ec --- /dev/null +++ b/DEV1.1/TP05/sapin.c @@ -0,0 +1,24 @@ +#include +#include + +int main(void){ + int hauteur; + int i; + int a; + int b; + printf("Hauteur de l'arbre :"); + scanf("%d", &hauteur); + int acc=hauteur-1; + for(i = hauteur ; i >= 0 ; i = i-1){ + for(b = acc; b = 0; b = b-1){ + printf(" "); + for(a = 0; a <= hauteur; a= a+1){ + printf("*"); + } + printf("\n"); + } + } + return EXIT_SUCCESS; +} + + \ No newline at end of file diff --git a/DEV1.1/TP05/table.c b/DEV1.1/TP05/table.c new file mode 100644 index 0000000..14c27ef --- /dev/null +++ b/DEV1.1/TP05/table.c @@ -0,0 +1,30 @@ +#include +#include + +int main(void){ + int x=0; + int b=0; + int cons=10; + int i; + int acc = 0; + printf (" X | "); + for(i=0; i <=cons; i = i+1){ + printf("%4d", i); + } + printf("\n"); + printf("----+"); + for(i = 0; i <=cons; i = i+1){ + printf("----"); + } + printf("-"); + printf("\n"); + for(x = 0; x <=cons; x = x+1){ + printf("%4d", x); + printf("|"); + for(b = 0; b<=cons; b = b+1){ + printf("%4d", x*b); + } + printf("\n"); + } + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP05/table.c* b/DEV1.1/TP05/table.c* new file mode 100644 index 0000000..727b85d --- /dev/null +++ b/DEV1.1/TP05/table.c* @@ -0,0 +1,6 @@ +#include +#include + +int main(void){ + int x=0; + \ No newline at end of file diff --git a/DEV1.1/TP06/affluence.c b/DEV1.1/TP06/affluence.c new file mode 100644 index 0000000..7305867 --- /dev/null +++ b/DEV1.1/TP06/affluence.c @@ -0,0 +1,27 @@ +#include +#include + +int main(void){ + double lundi; + double mardi; + double mercredi; + double jeudi; + double vendredi; + printf("Renseignez les clients : "); + scanf("%lf", &lundi); + printf("Renseignez les clients : "); + scanf("%lf", &mardi); + printf("Renseignez les clients : "); + scanf("%lf", &mercredi); + printf("Renseignez les clients : "); + scanf("%lf", &jeudi); + printf("Renseignez les clients : "); + scanf("%lf", &vendredi); + double valfinal = 0; + valfinal = valfinal + lundi + mardi + mercredi + jeudi + vendredi ; + valfinal = valfinal / 5; + printf("%lf", valfinal); + return EXIT_SUCCESS; +} + + \ No newline at end of file diff --git a/DEV1.1/TP06/alltype.c b/DEV1.1/TP06/alltype.c new file mode 100644 index 0000000..5f16bc5 --- /dev/null +++ b/DEV1.1/TP06/alltype.c @@ -0,0 +1,19 @@ +#include +#include + +int main(void){ + printf("%hhd\n", 77); + printf("%hhu\n", 77); + printf("%hd\n", 77); + printf("%hu\n", 77); + printf("%d\n", 77); + printf("%u\n", 77); + printf("%ld\n", 77); + printf("%lu\n", 77); + printf("%lld\n", 77); + printf("%llu\n", 77); + printf("%f\n", 77.0f); + printf("%lf\n", 77.0); + printf("%Lf\n", 77.0L); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP06/debordement.c b/DEV1.1/TP06/debordement.c new file mode 100644 index 0000000..be3ff3e --- /dev/null +++ b/DEV1.1/TP06/debordement.c @@ -0,0 +1,11 @@ +#include +#include + +int main(void){ + int nb1; + printf("Donnez un chiffre entier : "); + scanf("%d", & nb1); + char val = (char) nb1; + printf("%c", val); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP06/figure.c b/DEV1.1/TP06/figure.c new file mode 100644 index 0000000..fcd39bf --- /dev/null +++ b/DEV1.1/TP06/figure.c @@ -0,0 +1,51 @@ +#include +#include + +int main(void){ + int hauteur; + char lettre; + int etoile; + int a; + int i; + int b; + int d; + int e; + printf("t) Triangle \n"); + printf("c) Carré \n"); + printf("q) Quitter \n"); + printf("Votre choix ? : "); + scanf("%c", lettre); + if (lettre == "t"){ + printf("Hauteur ? : \n"); + scanf("%d", hauteur) + etoile = 1 + for(a = 0, a<=hauteur; a=a+1){ + for(i = 0, i +#include + +int main(void){ + int hauteur; + int i; + int a; + int b; + int espace; + int etoile; + printf("Hauteur de l'arbre :"); + scanf("%d", &hauteur); + int acc=hauteur-1; + espace = hauteur-1; + etoile = 1; + for(i = hauteur ; i >= 0 ; i = i-1){ + for(b = 0; b <= espace ; b = b+1){ + printf(" "); + } + for(a = 0; a < etoile; a= a+1){ + printf("*"); + } + printf("\n"); + espace=espace-1; + etoile=etoile+2; + } + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP07/arctique.c b/DEV1.1/TP07/arctique.c new file mode 100644 index 0000000..fb0ad57 --- /dev/null +++ b/DEV1.1/TP07/arctique.c @@ -0,0 +1,20 @@ +#include +#include +#include + +int main(void){ + double r; + double o; + double x; + double y; + printf(" Donnez les coordonnées polaires : \n"); + printf(" r = "); + scanf("%lf", &r); + printf(" o = "); + scanf("%lf", &o); + x = r*cos(o); + y = r*sin(o); + printf("%lf\n", x); + printf("%lf", y); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP07/chiffre.c b/DEV1.1/TP07/chiffre.c new file mode 100644 index 0000000..1ac28ed --- /dev/null +++ b/DEV1.1/TP07/chiffre.c @@ -0,0 +1,26 @@ +#include +#include +#include + +int main(void){ + double val1; + double val2; + int unite; + int dixieme; + printf("Donnez un réel : "); + scanf("%lf", &val1); + val2 = val1*10; + val1 = trunc(val1); + unite = (int) val1; + unite= unite%10; + printf("%d\n", unite); + val2 = trunc(val2); + dixieme = (int) val2; + dixieme= dixieme%10; + printf("%d", dixieme); + return EXIT_SUCCESS; +} + + + + \ No newline at end of file diff --git a/DEV1.1/TP07/data b/DEV1.1/TP07/data new file mode 100644 index 0000000..93a4845 --- /dev/null +++ b/DEV1.1/TP07/data @@ -0,0 +1 @@ +1 2 3 4 diff --git a/DEV1.1/TP07/distance.c b/DEV1.1/TP07/distance.c new file mode 100644 index 0000000..09e64e9 --- /dev/null +++ b/DEV1.1/TP07/distance.c @@ -0,0 +1,20 @@ +#include +#include +#include + +int main(void){ + double x1; + double x2; + double y1; + double y2; + double res; + printf("Donnez la coordonée 1 : \n"); + scanf("%lf", &x1); + scanf("%lf", &y1); + printf("Donnez la coordonée 2 : "); + scanf("%lf", &x2); + scanf("%lf", &y2); + res= sqrt(pow((x1-x2),2)+pow((y1-y2),2)); + printf("%lf", res); + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP07/formule.c b/DEV1.1/TP07/formule.c new file mode 100644 index 0000000..da4a631 --- /dev/null +++ b/DEV1.1/TP07/formule.c @@ -0,0 +1,27 @@ +#include +#include +#include + +int main(void){ + double val1; + double val2; + double val3; + double val4; + double val5; + double val6; + val1 = sqrt(fabs(log(0.5))); + val2 = sin(M_PI/6); + val3 = atan(pow(13,2)); + val4 = pow(exp(-1),4); + val5 = log(-3); + val6 = pow(sqrt(2),2); + printf("%lf\n", val1); + printf("%lf\n", val2); + printf("%lf\n", val3); + printf("%lf\n", val4); + printf("%lf\n", val5); + printf("%lf\n", val6); + return EXIT_SUCCESS; +} + + \ No newline at end of file diff --git a/DEV1.1/TP08/miroir.c b/DEV1.1/TP08/miroir.c new file mode 100644 index 0000000..4b59196 --- /dev/null +++ b/DEV1.1/TP08/miroir.c @@ -0,0 +1,85 @@ +#include +#include +#include +int main(void){ + int tab[10] = {}; + int i; + int b; + int a; + int c; + int d; + int e; + int f; + int acc=-51; + srand(time(NULL)); + for (i = 0; i< 10; i++){ + b = -50+rand()%101; + tab[i] = b; + if (tab[i] > acc){ + acc = tab[i]; + } + } + for(f = 0; f <= 9; f++){ + if (acc ==tab[f]){ + printf(" | "); + } + if (acc != tab[f]){ + printf(" "); + } + } + printf("\n"); + for(f = 0; f <= 9; f++){ + if (acc ==tab[f]){ + printf(" v "); + } + if (acc != tab[f]); + printf(" "); + } + printf("\n"); + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + printf("\n"); + for(d = 0; d < 10; d++){ + printf("|"); + printf("%5d", tab[d]); + } + printf("|"); + printf("\n"); + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + printf("\n"); + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + printf("\n"); + for(d = 9; d >= 0; d=d-1){ + printf("|"); + printf("%5d", tab[d]); + } + printf("|"); + printf("\n"); + + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + return EXIT_SUCCESS; +} + \ No newline at end of file diff --git a/DEV1.1/TP08/recherche.c b/DEV1.1/TP08/recherche.c new file mode 100644 index 0000000..fa303ba --- /dev/null +++ b/DEV1.1/TP08/recherche.c @@ -0,0 +1,76 @@ +#include +#include +#include +int main(void){ + int tab[10] = {}; + int i; + int b; + int a; + int c; + int d; + int e; + int f; + int g; + int vdr = -1; + int acc=-51; + srand(time(NULL)); + printf("Donnez une valeur"); + scanf("%d", &g); + for (i = 0; i< 10; i++){ + b = -50+rand()%101; + tab[i] = b; + if (tab[i] > acc){ + acc = tab[i]; + } + if (tab[i] == g){ + vdr == i; + } + } + for(f = 0; f <= 9; f++){ + if (acc ==tab[f]){ + printf(" | "); + } + if (acc != tab[f]){ + printf(" "); + } + } + printf("\n"); + for(f = 0; f <= 9; f++){ + if (acc ==tab[f]){ + printf(" v "); + } + if (acc != tab[f]); + printf(" "); + } + printf("\n"); + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + printf("\n"); + for(d = 0; d < 10; d++){ + printf("|"); + printf("%5d", tab[d]); + } + printf("|"); + printf("\n"); + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + printf("\n"); + if (vdr == -1){ + printf("%d", -1); + } + if (vdr != -1){ + printf("%d", vdr); + } + return EXIT_SUCCESS; +} + \ No newline at end of file diff --git a/DEV1.1/TP08/remplissage.c b/DEV1.1/TP08/remplissage.c new file mode 100644 index 0000000..bd3882f --- /dev/null +++ b/DEV1.1/TP08/remplissage.c @@ -0,0 +1,62 @@ +#include +#include +#include +int main(void){ + int tab[10] = {}; + int i; + int b; + int a; + int c; + int d; + int e; + int f; + int acc=-51; + srand(time(NULL)); + for (i = 0; i< 10; i++){ + b = -50+rand()%101; + tab[i] = b; + if (tab[i] > acc){ + acc = tab[i]; + } + } + for(f = 0; f <= 9; f++){ + if (acc ==tab[f]){ + printf(" | "); + } + if (acc != tab[f]){ + printf(" "); + } + } + printf("\n"); + for(f = 0; f <= 9; f++){ + if (acc ==tab[f]){ + printf(" v "); + } + if (acc != tab[f]); + printf(" "); + } + printf("\n"); + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + printf("\n"); + for(d = 0; d < 10; d++){ + printf("|"); + printf("%5d", tab[d]); + } + printf("|"); + printf("\n"); + for(a=0; a<=9;a++){ + printf("+"); + for(c=0; c <5; c++){ + printf("-"); + } + } + printf("+"); + return EXIT_SUCCESS; +} + \ No newline at end of file diff --git a/DEV1.1/TP09/horizontal.c b/DEV1.1/TP09/horizontal.c new file mode 100644 index 0000000..b9c5523 --- /dev/null +++ b/DEV1.1/TP09/horizontal.c @@ -0,0 +1,73 @@ +/****************************************************************************** + + Online C Compiler. + Code, Compile, Run and Debug C program online. +Write your code in this editor and press "Run" button to compile and execute it. + +*******************************************************************************/ + +#include + +int main() +{ + int t1 [2][5]; + int i; + int a; + int c = 0; + for(a=0; a<2; a++){ + for(i=1; i<=5; i++){ + t1[c][i] = i; + } + c++; + } + int t2 [3][5]; + int g; + int r; + int z=1; + int e = 0; + for(r=0; r<3; r++){ + for(g=0; g<5; g++){ + t2[e][g] = z; + z++; + } + e++ ; + } + int be; + int ba; + int acc = 0; + int bouc; + int t3[5][5]; + for(be=0; be<5; be++){ + for(ba=0; ba<5; ba++){ + if (ba >= be){ + t3[be][ba] = 0; + } + else{ + t3[be][ba] = ba+1; + } + } + printf("\n"); + } + int o; + int m; + for(o = 0; o < 5; o++){ + if (o<=2){ + for(m = 1; m <=5; m++){ + printf("[%d]", t1[o][m]); + } + printf(" "); + } + if (o<4){ + for(be=0; be<5; be++){ + printf("[%d]", t2[o][be]); + } + printf(" "); + } + for(ba = 0; ba<5; ba++){ + printf("[%d]", t3[o][ba]); + } + } + printf("\n"); + } + return 0; +} diff --git a/DEV1.1/TP09/pascal.c b/DEV1.1/TP09/pascal.c new file mode 100644 index 0000000..96c3c31 --- /dev/null +++ b/DEV1.1/TP09/pascal.c @@ -0,0 +1,30 @@ +#include +#include +int main(void){ + int acc = 0; + int tab [30][30]; + int a; + int b=0; + int c; + int i; + tab [0][0] = 1; + for(i=0; i <30; i++){ + for(a=0; a <= i; a++){ + if (a == 0 || a == i){ + tab [i][a] = 1; + } + else{ + tab[i][a] = tab[i-1][a-1] + tab[i-1][a]; + } + } + } + for(b = 0; b <5; b++){ + for(c = 0; c <= b; c++){ + printf("%5d", tab[b][c]); + } + printf("\n"); + } + return EXIT_SUCCESS; +} + + \ No newline at end of file diff --git a/DEV1.1/TP09/progression.c b/DEV1.1/TP09/progression.c new file mode 100644 index 0000000..0e14650 --- /dev/null +++ b/DEV1.1/TP09/progression.c @@ -0,0 +1,62 @@ +/****************************************************************************** + + Online C Compiler. + Code, Compile, Run and Debug C program online. +Write your code in this editor and press "Run" button to compile and execute it. + +*******************************************************************************/ + +#include + +int main() +{ + int t1 [2][5]; + int i; + int a; + int c = 0; + for(a=0; a<2; a++){ + for(i=1; i<=5; i++){ + t1[c][i] = i; + printf("[%d]", t1[c][i]); + } + c++; + printf("\n"); + } + printf("\n"); + printf("\n"); + int t2 [3][5]; + int g; + int r; + int z=1; + int e = 0; + for(r=0; r<3; r++){ + for(g=0; g<5; g++){ + t2[e][g] = z; + printf("[%d]", t2[e][g]); + z++; + } + printf("\n"); + e++ ; + } + printf("\n"); + printf("\n"); + int be; + int ba; + int acc = 0; + int bouc; + int t3[5][5]; + for(be=0; be<5; be++){ + for(ba=0; ba<5; ba++){ + if (ba >= be){ + t3[be][ba] = 0; + } + else{ + t3[be][ba] = ba+1; + } + printf("[%d]", t3[be][ba]); + } + printf("\n"); + } + + return 0; +} diff --git a/DEV1.1/TP10/ALphabet.txt b/DEV1.1/TP10/ALphabet.txt new file mode 100644 index 0000000..69737d9 --- /dev/null +++ b/DEV1.1/TP10/ALphabet.txt @@ -0,0 +1,3 @@ +Selon moi le programme écrira l'équivalent en caractère de l'adresse fourni par le test d'égalité de p et l'adresse du caractère min si ce test +est vrai alors il affichera le caractère de l'adresse maj sinon celui de l'adresse min. +FFFFFFFIONNNN \ No newline at end of file diff --git a/DEV1.1/TP10/Mortvivant.txt b/DEV1.1/TP10/Mortvivant.txt new file mode 100644 index 0000000..45bce06 --- /dev/null +++ b/DEV1.1/TP10/Mortvivant.txt @@ -0,0 +1,3 @@ +La valeur s'affichant sera le nombre 59 ou le nombre 31 cela dépend du temps +cette variable au moment de l'affichage dans la variable p +L'affichage final ne changera pas car le résultat est déja dans p non obstant cela affichera leurs adresses diff --git a/DEV1.1/TP10/cartographie.c b/DEV1.1/TP10/cartographie.c new file mode 100644 index 0000000..533abea --- /dev/null +++ b/DEV1.1/TP10/cartographie.c @@ -0,0 +1,19 @@ +#include +#include +int main(void){ + float a= 2.5; + double b = 3.5; + long double c = 85.8; + char d = 48; + short int e = 3; + int f = 8; + long long unsigned int g = 48; + printf("%p\n", &a); + printf("%p\n", &b); + printf("%p\n", &c); + printf("%p\n", &d); + printf("%p\n", &e); + printf("%p\n", &f); + printf("%p\n", &g); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP10/test.c b/DEV1.1/TP10/test.c new file mode 100644 index 0000000..a615c3e --- /dev/null +++ b/DEV1.1/TP10/test.c @@ -0,0 +1,8 @@ +#include +#include +int main(void) { + double n = 6.283186; + long long int* p = (long long int*) &n; + printf("π = %ld\n", *p); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP11/initiales.c b/DEV1.1/TP11/initiales.c new file mode 100644 index 0000000..f75dd52 --- /dev/null +++ b/DEV1.1/TP11/initiales.c @@ -0,0 +1,11 @@ +#include +#include +#include +int main(int argc, char* argv[]){ + int i; + char c[100]; + for(i=0; i +#include +#include +int main(void) { + char mdp[6] = "salut"; + char essai[26]= ""; + int i; + do{ + essai[i] = getchar(); + }while(essai[i++] != '\n' && i<26); + essai[5] = 0; + if (strcmp(mdp,essai) == 0){ + printf("BONMDP\n"); + } + else{ + printf("PASBON\n"); + } + return EXIT_SUCCESS; +} + + \ No newline at end of file diff --git a/DEV1.1/TP11/multiplication.c b/DEV1.1/TP11/multiplication.c new file mode 100644 index 0000000..8914a33 --- /dev/null +++ b/DEV1.1/TP11/multiplication.c @@ -0,0 +1,9 @@ +#include +#include +#include +int main(int argc, int argv[]){ + int res; + res = argv[1] * argv[2]; + printf("%d", res); + return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP11/statistiques.c b/DEV1.1/TP11/statistiques.c new file mode 100644 index 0000000..a352969 --- /dev/null +++ b/DEV1.1/TP11/statistiques.c @@ -0,0 +1,49 @@ +#include +#include +#include +int main(void) { + char chaine[200]; + int i; + int longueur; + int a; + int acc = 0; + char test[200]; + char existante[200]; + int non = 0; + int oui = 0; + int b = 0; + int c = 0; + printf("chaine de caractère : "); + fgets(chaine,200,stdin); + for(i = 0 ; chaine[i] != '\0'; i++){ + } + printf("%d", i); + for(a = 0; a <= i ; a++){ + if(chaine[a] == 'e'){ + acc++; + } + } + longueur = strlen(chaine); + for(a= 0; a