12 Octobre

This commit is contained in:
2022-10-12 16:41:36 +02:00
parent 965589da20
commit d6fccd8f37
6 changed files with 119 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
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;
}