From 1765a453cfdc70ed42a01aa7a59bcae02f65d4fa Mon Sep 17 00:00:00 2001 From: Bekkouche Anis Date: Mon, 7 Oct 2024 17:30:04 +0200 Subject: [PATCH] ejeejh --- DEV1.1/TP09/sapin.c | 44 +++++++++++++++++++++++++++ DEV1.1/TP10/affluence.c | 25 ++++++++++++++++ DEV1.1/TP10/debord.c | 12 ++++++++ DEV1.1/TP10/monnaie.c | 28 +++++++++++++++++ DEV1.1/TP10/variete.c | 6 ++++ DEV1.1/TP11/distance.c | 23 ++++++++++++++ DEV1.1/TP11/formules | Bin 0 -> 15472 bytes DEV1.1/TP11/formules.c | 20 +++++++++++++ DEV1.1/TP12/maximum.c | 29 ++++++++++++++++++ DEV1.1/TP12/recherche.c | 24 +++++++++++++++ DEV1.1/TP12/remplissage.c | 14 +++++++++ DEV1.1/TP13/horizontal.c | 60 +++++++++++++++++++++++++++++++++++++ DEV1.1/TP13/progressions.c | 56 ++++++++++++++++++++++++++++++++++ DEV1.1/TP14/cartographie.c | 23 ++++++++++++++ DEV1.1/TP15/lecture.c | 28 +++++++++++++++++ DEV1.1/TP15/stats.c | 7 +++++ 16 files changed, 399 insertions(+) create mode 100644 DEV1.1/TP09/sapin.c create mode 100644 DEV1.1/TP10/affluence.c create mode 100644 DEV1.1/TP10/debord.c create mode 100644 DEV1.1/TP10/monnaie.c create mode 100644 DEV1.1/TP10/variete.c create mode 100644 DEV1.1/TP11/distance.c create mode 100755 DEV1.1/TP11/formules create mode 100644 DEV1.1/TP11/formules.c create mode 100644 DEV1.1/TP12/maximum.c create mode 100644 DEV1.1/TP12/recherche.c create mode 100644 DEV1.1/TP12/remplissage.c create mode 100644 DEV1.1/TP13/horizontal.c create mode 100644 DEV1.1/TP13/progressions.c create mode 100644 DEV1.1/TP14/cartographie.c create mode 100644 DEV1.1/TP15/lecture.c create mode 100644 DEV1.1/TP15/stats.c diff --git a/DEV1.1/TP09/sapin.c b/DEV1.1/TP09/sapin.c new file mode 100644 index 0000000..e1e1cb6 --- /dev/null +++ b/DEV1.1/TP09/sapin.c @@ -0,0 +1,44 @@ +#include +#include + +int main(void) { + int hauteur; + char space = ' '; + char etoile = '*'; + int n_space; + int n_etoile = 1; + int n1_etoile = n_etoile; + int nf_etoile = 11; + printf("Hauteur ? "); + scanf("%d", &hauteur); + + for (; n_etoile <= nf_etoile; n_etoile++){ + n_space = 11 - n_etoile; + while (n_space > 0) { + printf("%c", space); + n_space--; + if (n_space == 0){ + printf("\n"); + break; + } + } + n_space = 11 - n1_etoile; + while (n1_etoile <= 11) { + printf("%c", etoile); + n1_etoile--; + if (n1_etoile == 0){ + printf("\n"); + break; + } + } + while (n_space > 0) { + printf("%c", space); + n_space--; + if (n_space == 0){ + printf("\n"); + break; + } + } + } + +} diff --git a/DEV1.1/TP10/affluence.c b/DEV1.1/TP10/affluence.c new file mode 100644 index 0000000..aef138c --- /dev/null +++ b/DEV1.1/TP10/affluence.c @@ -0,0 +1,25 @@ +#include +#include + +int main(void) { + int lundi; + int mardi; + int mercredi; + int jeudi; + int vendredi; + double moyenne; + printf("Veuillez entrer le nombre de visiteurs à franchir les portes du magasin chaque jour de la semaine\n"); + printf("Lundi: \n"); + scanf("%d", &lundi); + printf("Mardi: \n"); + scanf("%d", &mardi); + printf("Mercredi: \n"); + scanf("%d", &mercredi); + printf("Jeudi: \n"); + scanf("%d", &jeudi); + printf("Vendredi: \n"); + scanf("%d", &vendredi); + moyenne = (double) (lundi + mardi + mercredi + jeudi + vendredi)/5; + printf("La moyenne de visiteurs de cette semaine est de %f visiteurs.\n", moyenne); + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP10/debord.c b/DEV1.1/TP10/debord.c new file mode 100644 index 0000000..43ead1a --- /dev/null +++ b/DEV1.1/TP10/debord.c @@ -0,0 +1,12 @@ +#include +#include + +int main(void) { + int nombre; + char nombre1; + printf("Veuillez entrer un entier :\n"); + scanf("%d", &nombre); + nombre1 = (char) nombre; + printf("%c\n", nombre1); + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP10/monnaie.c b/DEV1.1/TP10/monnaie.c new file mode 100644 index 0000000..df0e471 --- /dev/null +++ b/DEV1.1/TP10/monnaie.c @@ -0,0 +1,28 @@ +#include +#include + +int main(void) { + double paiement; + double produit = 5.49; + int n_2e; + int n_20c; + int n_1c; + printf("Veuillez entrer combien vous avez payé en euros pour vous rendre la monnaie\n"); + scanf("%lf", &paiement); + if(paiement >= produit){ + paiement = paiement - produit; + for(; paiement >= 2; n_2e+=1){ + paiement = paiement - 2; + } + for(; paiement >= 0.20; n_20c+=1){ + paiement = paiement - 0.2; + } + for(; paiement >= 0.0080; n_1c+=1){ + paiement = paiement - 0.01; + } + printf("Je vous rend %d pièce(s) de 2euros, %d pièce(s) de 20centimes et %d pièce(s) de 1centime. \n ", n_2e, n_20c, n_1c); + } + else if (paiement < produit) { + printf("Tu ne paies pas assez !!!!!!!!!!!!!\n"); + } +} diff --git a/DEV1.1/TP10/variete.c b/DEV1.1/TP10/variete.c new file mode 100644 index 0000000..e2f0afa --- /dev/null +++ b/DEV1.1/TP10/variete.c @@ -0,0 +1,6 @@ +#include +#include + +int main(void) { + printf("%c%c %hhu %hd %hu %d %u %ld %lu %f \n", 067, 067, 77, 77, 77, 77, 77, 77, 77, 77, 77.0, 77.0); +} diff --git a/DEV1.1/TP11/distance.c b/DEV1.1/TP11/distance.c new file mode 100644 index 0000000..8b9de9a --- /dev/null +++ b/DEV1.1/TP11/distance.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int main(void){ + double pddistance; + double xppoint; + double xdpoint; + double yppoint; + double ydpoint; + printf("Ecris les coordonnées du premier point en X: \n"); + scanf("%lf",&xppoint); + printf("Ecris les coordonnées du deuxieme point en X: \n"); + scanf("%lf",&xdpoint); + printf("Ecris les coordonnées du premier point en Y: \n"); + scanf("%lf",&yppoint); + printf("Ecris les coordonnées du deuxieme point en Y: \n"); + scanf("%lf",&ydpoint); + printf("Ecris les coordonnées du troisième point en Y: \n"); + pddistance = (double) (pow((xdpoint - xppoint),2) + (pow((ydpoint - yppoint),2))); + printf("La distance entre le premier et deuxieme point est %lf\n", pddistance); + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP11/formules b/DEV1.1/TP11/formules new file mode 100755 index 0000000000000000000000000000000000000000..b5a1a53d1151ec1c37e73c77a830a6bc989fdbe9 GIT binary patch literal 15472 zcmeHOU2Ggz6~4Q+6NlDbC#s2?w9T|6$VGT!JGMz0T(5uD9v3@F6B~>m9oF8pcg1?w z?5?R(RmCEul8GWUeSlK65=aPIL)M(xRl4EZ>jD4@nYlz4ACYgd$S$eh{yU zI#~D08unA9^gHuuL`Ko9ts~!ORiv9ot`wSVgF@$8`4yfo!BTjn5^srlOUx6wN)Dlj zlz381sP5%>dSw`WRKnI)DKBr1d0yGa_9AHxDo0+=$NrP~4l!>`vxZS#xzmP~NSW_m z@c7WO#r1_8=EFSSddDHm@fXSARl8Hk@s76LsaR7gnVy|%n%mpa)X}ErGJ2~uG5OVu zN^5H1z^Dq&s{&!d52%2pZvsXo$h!2C?M$5U}-np4x6w3*9Cvw73BP0JdlGE*?dA)R33 z>1Z+yWMVFAPA1dQRPuqin#m^9`AG$xE_$KM#^DTnD3wJQ&OZsObIFBU=TD|wbm26Xlw}vbQ9zPm zTOo{3H5O3q!rklIw)VGv1pEm25%446N5GGO9|1oCA9V!&9=h#4gM=EbV_(F`0tTk`kpWT{Q@pz$tG z!FCj5Adt;(hw7@%*DCdPXmezVl$Tk#NXiSWER#}TWd#oZ3hhZFlrF6N7QC~?{xC3tiNn_(I!a?v;uS(*$rzJdB0>Lt_*sEgKs2<;AxU@W|Jnr_rr z?!x$|(NO2;2s_8$IpWmi7e4}i1pEm25%446N5GGO9|1oCegymo_!0PjivYccqOvPB zsgj|UG&u85C7ctncI)9yi|O(>%H0|=YPHFYS+7;z5Vp)naB98Pj!LcDTM>u zEB5aMncnp*zF91eL0*9jL%y|IEY3qxp?9EE0uLNkfw{WC_8T`=KZ-#JzXkQ@;Czw{ z`Zii`wr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do)|^WSH8$P_p?m!u3x&o(i9SZrLiH)F;+!L{6zmH8gBl2->-?i zcm8u8{=8;eihNLrEWPu;0vy?V)^C7JzzYfp2zOAXJ@=1!OJy}v) +#include +#include + +int main(void) { + double prem; + double deux; + double troi; + double quat; + double cinq; + double sixi; + prem =sqrt(fabs(log(0.5))); + deux = (double) sin(3.1415/6); + troi = (double) atan(pow(13, 2)); + quat = (double) pow(exp(-1), 4); + cinq = (double) log(-3); + sixi = (double) pow(sqrt(2), 2); + printf("%lf %lf %lf %lf %lf %lf\n", prem, deux, troi, quat, cinq, sixi); + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP12/maximum.c b/DEV1.1/TP12/maximum.c new file mode 100644 index 0000000..02c7b5a --- /dev/null +++ b/DEV1.1/TP12/maximum.c @@ -0,0 +1,29 @@ +#include +#include +#include +#include + +int main(void) { + int tableau[10]; + int i; + int n_max; + int index_precedent; + srand(time(NULL)); + for(i=0; i<10;i++){ + tableau[i]= (rand()%101)-50; + printf("%d\n", tableau[i]); + if (i==0){ + index_precedent = i; + n_max = tableau[i]; + } + else { + index_precedent = i-1; + if (tableau[i]>n_max){ + n_max = tableau[i]; + } + } + } + + + printf("Le plus grand élément du tableau est %d.\n", n_max); +} diff --git a/DEV1.1/TP12/recherche.c b/DEV1.1/TP12/recherche.c new file mode 100644 index 0000000..a4ef85f --- /dev/null +++ b/DEV1.1/TP12/recherche.c @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +int main(void) { + int tableau[10]; + int i; + int valeur_recherch; + srand(time(NULL)); + for(i=0; i<10;i++){ + tableau[i]= (rand()%101)-50; + } + printf("Quelle valeur recherchez-vous ?\n"); + scanf("%d", &valeur_recherch); + for(i=0; i<10;i++){ + if (tableau[i] == valeur_recherch){ + printf("%d\n", i); + } + else { + printf("-1\n"); + } + } +} diff --git a/DEV1.1/TP12/remplissage.c b/DEV1.1/TP12/remplissage.c new file mode 100644 index 0000000..154c836 --- /dev/null +++ b/DEV1.1/TP12/remplissage.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +int main(void) { + int tableau[10]; + int i; + srand(time(NULL)); + for(i=0; i<10;i++){ + tableau[i]= (rand()%101)-50; + printf("%d\n", tableau[i]); + } +} diff --git a/DEV1.1/TP13/horizontal.c b/DEV1.1/TP13/horizontal.c new file mode 100644 index 0000000..38c73e9 --- /dev/null +++ b/DEV1.1/TP13/horizontal.c @@ -0,0 +1,60 @@ +#include +#include + +int main(void){ + int t1[2][5]; + int t2[3][5]; + int t3[5][5]; + int i; + int j; + + for(i=0; i<2; i++){ + for(j=0; j<5; j++){ + t1[i][j]=j+1; + + } + + } + + + for(i=0; i<3; i++){ + for(j=0; j<5; j++){ + t2[i][j]=j+1+i*5; + } + for(i=0; i<2; i++){ + for(j=0; j<5; j++){ + t1[i][j]=j+1; + + } + } + } + + + + + for(i=0; i<2; i++){ + for(j=0; j<5; j++){ + + printf("%d ", t1[i][j]); + } + printf("\n"); + } + + for(i=0; i<3; i++){ + for(j=0; j<5; j++){ + + printf("%d ", t2[i][j]); + + } + printf("\n"); + } + printf("\n"); + + + + + + + + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP13/progressions.c b/DEV1.1/TP13/progressions.c new file mode 100644 index 0000000..c884045 --- /dev/null +++ b/DEV1.1/TP13/progressions.c @@ -0,0 +1,56 @@ +#include +#include + +int main(void){ + int t1[2][5]; + int t2[3][5]; + int t3[5][5]; + int i; + int j; + + for(i=0; i<2; i++){ + for(j=0; j<5; j++){ + t1[i][j]=j+1; + + } + + } + + + for(i=0; i<3; i++){ + for(j=0; j<5; j++){ + t2[i][j]=j+1+i*5; + } + + } + + + + + for(i=0; i<2; i++){ + for(j=0; j<5; j++){ + + printf("%d ", t1[i][j]); + } + printf("\n"); + } + printf("\n"); + + for(i=0; i<3; i++){ + for(j=0; j<5; j++){ + + printf("%d ", t2[i][j]); + + } + printf("\n"); + } + printf("\n"); + + + + + + + + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP14/cartographie.c b/DEV1.1/TP14/cartographie.c new file mode 100644 index 0000000..9cadc48 --- /dev/null +++ b/DEV1.1/TP14/cartographie.c @@ -0,0 +1,23 @@ +#include +#include + +int main(void){ + float a; + double b; + long double c; + char d; + short int e; + int f; + unsigned long int g; + float* A =&a; + double* B =&b; + long double* C= &c; + char* D= &d; + short int* E = &e; + int* F= &f; + unsigned long int* G= &g; + + printf("%p\n %p\n %p\n %p\n %p\n %p\n %p\n", A, B,C,D,E,F,G); + + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP15/lecture.c b/DEV1.1/TP15/lecture.c new file mode 100644 index 0000000..0833864 --- /dev/null +++ b/DEV1.1/TP15/lecture.c @@ -0,0 +1,28 @@ +#include +#include +#include + +int main(void){ + int i=0; + int nb_juste=0; + char mdp_secret[26] = {'J','s','a','i','s','p','a','s','\0'}; + char mot_de_passe[26]; + while(i<26){ + mot_de_passe[i]= getchar(); + if (mot_de_passe[i]==mdp_secret[i]){ + nb_juste++; + } + if(mot_de_passe[i]==13){ + break; + } + i++; + if (nb_juste==1){ + printf("Accès accordé\n"); + break; + } + else { + printf("Accès refusé\n"); + break; + } + } +} diff --git a/DEV1.1/TP15/stats.c b/DEV1.1/TP15/stats.c new file mode 100644 index 0000000..702489b --- /dev/null +++ b/DEV1.1/TP15/stats.c @@ -0,0 +1,7 @@ +#include +#include +#include + +int main(void){ + +}