This commit is contained in:
2023-10-23 13:23:36 +02:00
parent 667dae6f1a
commit 322b22f9bf
5711 changed files with 72953 additions and 0 deletions

BIN
DEV/DEV1.1/TP_Tableau/exe Executable file

Binary file not shown.

View File

@@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int position;
int tableau[10];
srand(time(NULL));
for (position=0;position<10;position++){
tableau[position]=((rand()%101)-50);
printf("%d",position);
printf(" --> ");
printf("%d\n",tableau[position]);
}
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int position;
int tableau[10];
int max=-50;
srand(time(NULL));
for (position=0;position<10;position++){
tableau[position]=((rand()%101)-50);
if (max<tableau[position]){
max = tableau[position];
}
}
for (position=0;position<10;position++){
printf("%d",position);
printf(" --> ");
printf("%d",tableau[position]);
if (max==tableau[position]){
printf(" <-- élément le plus grand");
}
printf("\n");
}
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int position;
int tableau[10];
int valeur;
srand(time(NULL));
for (position=0;position<10;position++){
tableau[position]=((rand()%101)-50);
printf("%d",position);
printf(" --> ");
printf("%d\n",tableau[position]);
}
printf("choisissez une valeur : ");
scanf("%d",&valeur);
printf("position dans le tableau : ");
for (position=0;position<10;position++){
if (valeur==tableau[position]){
printf("%d\n",position);
return EXIT_SUCCESS;
}
}
printf("-1\n");
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,24 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int position;
int tableau[10];
int tableauInv[10];
srand(time(NULL));
for (position=0;position<10;position++){
tableau[position]=((rand()%101)-50);
printf("%d",position);
printf(" --> ");
printf("%d\n",tableau[position]);
}
printf("\n");
for (position=0;position<10;position++){
tableauInv[position]=tableau[9-position];
printf("%d",position);
printf(" --> ");
printf("%d\n",tableauInv[position]);
}
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int position;
int tableau[10];
int tableauPositif[10];
int position2=0;
srand(time(NULL));
for (position=0;position<10;position++){
tableau[position]=((rand()%101)-50);
printf("%d",position);
printf(" --> ");
printf("%d\n",tableau[position]);
}
printf("\n");
for (position=0;position<10;position++){
if (tableau[position]>=0){
tableauPositif[position2]=tableau[position];
printf("%d",position2);
printf(" --> ");
printf("%d\n",tableauPositif[position2]);
position2++;
}
}
return EXIT_SUCCESS;
}

View File