diff --git a/DEV1.1/TP11/maximum b/DEV1.1/TP11/maximum new file mode 100755 index 0000000..c18104d Binary files /dev/null and b/DEV1.1/TP11/maximum differ diff --git a/DEV1.1/TP11/maximum.c b/DEV1.1/TP11/maximum.c new file mode 100644 index 0000000..8af079c --- /dev/null +++ b/DEV1.1/TP11/maximum.c @@ -0,0 +1,48 @@ +#include +#include +#include + +int main(void) { + int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe,val_max,indice; + int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10}; + srand(time(NULL)); + for (tour=0;tour<10;tour++){ + tab_val[tour]=rand()%51; + int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)}; + signe=rand()%2; + tab_val[tour]=tab_temp[signe]; + } + val_max=tab_val[0]; + indice=0; + for (tour=1;tour<10;tour++){ + if (val_max +#include +#include + +int main(void) { + int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe; + int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10}; + srand(time(NULL)); + for (tour=0;tour<10;tour++){ + tab_val[tour]=rand()%51; + int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)}; + signe=rand()%2; + tab_val[tour]=tab_temp[signe]; + } + int tab_val_inverse[10]={}; + for (tour=0;tour<10;tour++) + tab_val_inverse[tour]=tab_val[(9-tour)]; + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + printf("|"); + for (tour=0;tour<10;tour++) + printf("%4d |",tab_val[tour]); + printf("\n"); + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + printf("|"); + for (tour=0;tour<10;tour++) + printf("%4d |",tab_val_inverse[tour]); + printf("\n"); + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP11/progression.c b/DEV1.1/TP11/progression.c new file mode 100644 index 0000000..311a993 --- /dev/null +++ b/DEV1.1/TP11/progression.c @@ -0,0 +1,37 @@ +#include +#include +#include + +int main(void) { + int tour,tour2,val; + int t1[2][5]; + int t2[3][5]; + int t3[5][5]; + for (tour=0;tour<2;tour++){ + for (tour2=1;tour2<6;tour2++) + t1[tour][tour2]=tour; + } + for (tour=0;tour<3;tour++){ + for (tour2=1;tour2<6;tour2++) + val=tour+tour2; + t2[tour][tour2]=val; + } + for (tour=0;tour<5;tour++){ + for (tour2=1;tour2<6;tour2++) + val=tour+tour2; + t3[tour][tour2]=val; + } + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + printf("|"); + for (tour=0;tour<10;tour++) + printf("%4d |",tab_val[tour]); + printf("\n"); + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP11/recherche b/DEV1.1/TP11/recherche new file mode 100755 index 0000000..2cf8e48 Binary files /dev/null and b/DEV1.1/TP11/recherche differ diff --git a/DEV1.1/TP11/recherche.c b/DEV1.1/TP11/recherche.c new file mode 100644 index 0000000..9156d7f --- /dev/null +++ b/DEV1.1/TP11/recherche.c @@ -0,0 +1,35 @@ +#include +#include +#include + +int main(void) { + int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe,valeur,indice=-1; + int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10}; + srand(time(NULL)); + for (tour=0;tour<10;tour++){ + tab_val[tour]=rand()%51; + int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)}; + signe=rand()%2; + tab_val[tour]=tab_temp[signe]; + } + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + printf("|"); + for (tour=0;tour<10;tour++) + printf("%4d |",tab_val[tour]); + printf("\n"); + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + printf("Donnez un entier qui se trouve dans le tableau : "); + scanf("%d",&valeur); + for (tour=0;tour<10;tour++){ + if (valeur==tab_val[tour]) + indice=tour; + } + printf("indice : %d \n",indice); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP11/remplissage b/DEV1.1/TP11/remplissage index c532584..867d007 100755 Binary files a/DEV1.1/TP11/remplissage and b/DEV1.1/TP11/remplissage differ diff --git a/DEV1.1/TP11/remplissage.c b/DEV1.1/TP11/remplissage.c index 560b430..303876f 100644 --- a/DEV1.1/TP11/remplissage.c +++ b/DEV1.1/TP11/remplissage.c @@ -5,22 +5,24 @@ int main(void) { int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe; int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10}; + srand(time(NULL)); for (tour=0;tour<10;tour++){ - srand(time(NULL)); tab_val[tour]=rand()%51; int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)}; - srand(time(NULL)); - signe==rand()%2; + signe=rand()%2; tab_val[tour]=tab_temp[signe]; } printf("+"); for (tour=0;tour<10;tour++) printf("-----+"); + printf("\n"); printf("|"); for (tour=0;tour<10;tour++) - printf("%3d |"); + printf("%4d |",tab_val[tour]); + printf("\n"); printf("+"); for (tour=0;tour<10;tour++) printf("-----+"); + printf("\n"); return EXIT_SUCCESS; } \ No newline at end of file diff --git a/DEV1.1/TP12/progression.c b/DEV1.1/TP12/progression.c new file mode 100644 index 0000000..311a993 --- /dev/null +++ b/DEV1.1/TP12/progression.c @@ -0,0 +1,37 @@ +#include +#include +#include + +int main(void) { + int tour,tour2,val; + int t1[2][5]; + int t2[3][5]; + int t3[5][5]; + for (tour=0;tour<2;tour++){ + for (tour2=1;tour2<6;tour2++) + t1[tour][tour2]=tour; + } + for (tour=0;tour<3;tour++){ + for (tour2=1;tour2<6;tour2++) + val=tour+tour2; + t2[tour][tour2]=val; + } + for (tour=0;tour<5;tour++){ + for (tour2=1;tour2<6;tour2++) + val=tour+tour2; + t3[tour][tour2]=val; + } + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + printf("|"); + for (tour=0;tour<10;tour++) + printf("%4d |",tab_val[tour]); + printf("\n"); + printf("+"); + for (tour=0;tour<10;tour++) + printf("-----+"); + printf("\n"); + return EXIT_SUCCESS; +} \ No newline at end of file