58 lines
997 B
C
58 lines
997 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<time.h>
|
|
#define MIN -50
|
|
#define MAX 50
|
|
int affiche(int tab[])
|
|
{
|
|
int cpt=0;
|
|
int cpt2 = 0;
|
|
int cpt3 = 0;
|
|
int tab2[10];
|
|
printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+----+\n");
|
|
printf("|");
|
|
cpt3=9;
|
|
while(cpt3>=0)
|
|
{
|
|
printf("%3d | ", tab2[cpt3]);
|
|
cpt3--;
|
|
}
|
|
printf("\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+----+\n");
|
|
printf("|");
|
|
cpt3=0;
|
|
return tab2[10];
|
|
}
|
|
int aleatoire(int taille){
|
|
int tab[10];
|
|
int cpt = 0;
|
|
int cpt2 = 0;
|
|
int cpt3 = 0;
|
|
srand(time(NULL));
|
|
while(cpt<10)
|
|
{
|
|
tab[cpt]=rand()%(MAX+(-MIN))+MIN;
|
|
cpt++;
|
|
}
|
|
return taille;
|
|
}
|
|
int inverse() {
|
|
int tab2[10];
|
|
int cpt2=0;
|
|
while(cpt2<=9)
|
|
{
|
|
printf("%3d | ", tab2[cpt2]);
|
|
cpt2++;
|
|
}
|
|
printf("\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+----+\n");
|
|
}
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
int tab[10];
|
|
aleatoire(10);
|
|
affiche(tab);
|
|
inverse();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|