update
This commit is contained in:
BIN
DEV/DEV1.1/TP_Tableau/exe
Executable file
BIN
DEV/DEV1.1/TP_Tableau/exe
Executable file
Binary file not shown.
16
DEV/DEV1.1/TP_Tableau/q1.c
Normal file
16
DEV/DEV1.1/TP_Tableau/q1.c
Normal 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;
|
||||
}
|
0
DEV/DEV1.1/TP_Tableau/q1.c~
Normal file
0
DEV/DEV1.1/TP_Tableau/q1.c~
Normal file
26
DEV/DEV1.1/TP_Tableau/q2.c
Normal file
26
DEV/DEV1.1/TP_Tableau/q2.c
Normal 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;
|
||||
}
|
0
DEV/DEV1.1/TP_Tableau/q2.c~
Normal file
0
DEV/DEV1.1/TP_Tableau/q2.c~
Normal file
27
DEV/DEV1.1/TP_Tableau/q3.c
Normal file
27
DEV/DEV1.1/TP_Tableau/q3.c
Normal 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;
|
||||
}
|
0
DEV/DEV1.1/TP_Tableau/q3.c~
Normal file
0
DEV/DEV1.1/TP_Tableau/q3.c~
Normal file
24
DEV/DEV1.1/TP_Tableau/q4.c
Normal file
24
DEV/DEV1.1/TP_Tableau/q4.c
Normal 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;
|
||||
}
|
0
DEV/DEV1.1/TP_Tableau/q4.c~
Normal file
0
DEV/DEV1.1/TP_Tableau/q4.c~
Normal file
28
DEV/DEV1.1/TP_Tableau/q5.c
Normal file
28
DEV/DEV1.1/TP_Tableau/q5.c
Normal 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;
|
||||
}
|
0
DEV/DEV1.1/TP_Tableau/q5.c~
Normal file
0
DEV/DEV1.1/TP_Tableau/q5.c~
Normal file
Reference in New Issue
Block a user