diff --git a/DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/.nfs00000000008c1c9600000051 b/DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/.nfs00000000008c1c9600000051 deleted file mode 100755 index 01787a6..0000000 Binary files a/DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/.nfs00000000008c1c9600000051 and /dev/null differ diff --git a/DEV1.1/TP06:Tableaux/filtre.c b/DEV1.1/TP06:Tableaux/filtre.c new file mode 100644 index 0000000..a257f2c --- /dev/null +++ b/DEV1.1/TP06:Tableaux/filtre.c @@ -0,0 +1,25 @@ +#include +#include +#include + +int main() { + int i; + int tab[10]; + srand(time(NULL)); + for (i=0;i<10;i++){ + tab[i]=((rand()%101)-50); + } printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + for (i=0;i<10;i++){ + printf("| %3d ",tab[i]); + } printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + printf("Voici le tableau sans les valeurs negatives:\n"); + printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + for (i=0;i<10;i++){ + if (tab[i]>0){ + printf("| %3d ",tab[i]); + } else{ + printf("| "); + } + } printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); +return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP06:Tableaux/maximum.c b/DEV1.1/TP06:Tableaux/maximum.c new file mode 100644 index 0000000..c86e021 --- /dev/null +++ b/DEV1.1/TP06:Tableaux/maximum.c @@ -0,0 +1,22 @@ +#include +#include +#include + +int main() { + int i; + int max; + int tab[10]; + srand(time(NULL)); + for (i=0;i<10;i++){ + tab[i]=((rand()%101)-50); + } printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + max=tab[0]; + for (i=0;i<10;i++){ + printf("| %3d ",tab[i]); + if (max +#include +#include + +int main() { + int i; + int j; + int k; + int tab[10]; + srand(time(NULL)); + for (i=0;i<10;i++){ + tab[i]=((rand()%101)-50); + } printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + for (i=0;i<10;i++){ + printf("| %3d ",tab[i]); + } printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + printf("Voici le tableaux inverse:\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + i=9; + for(j=0;j<5;j++){ + k=tab[j]; + tab[j]=tab[i]; + tab[i]=k; + i--; + } + for (i=0;i<10;i++){ + printf("| %3d ",tab[i]); + } printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); +return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP06:Tableaux/recherche.c b/DEV1.1/TP06:Tableaux/recherche.c new file mode 100644 index 0000000..5c6fd5e --- /dev/null +++ b/DEV1.1/TP06:Tableaux/recherche.c @@ -0,0 +1,27 @@ +#include +#include +#include + +int main() { + int i; + int n; + int m; + int min=-1; + int tab[10]; + srand(time(NULL)); + for (i=0;i<10;i++){ + tab[i]=((rand()%101)-50); + } printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + for (i=0;i<10;i++){ + printf("| %3d ",tab[i]); + } printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + printf("Veuillez saisir un entier : "); + scanf("%d",&m); + for (i=0;i<10;i++){ + if (tab[i]==m){ + min = i; + break; + } + } printf("Le plus petit indice ou se trouve votre entier est %d .\n",min); +return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP06:Tableaux/remplissage.c b/DEV1.1/TP06:Tableaux/remplissage.c new file mode 100644 index 0000000..381bec5 --- /dev/null +++ b/DEV1.1/TP06:Tableaux/remplissage.c @@ -0,0 +1,16 @@ +#include +#include +#include + +int main() { + int i; + int tab[10]; + srand(time(NULL)); + for (i=0;i<10;i++){ + tab[i]=((rand()%101)-50); + } printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); + for (i=0;i<10;i++){ + printf("| %3d ",tab[i]); + } printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n"); +return 0; +} \ No newline at end of file