#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define ARRAY_SIZE 32
void caracArray(int array[ARRAY_SIZE], int *pmin, int *pmax, float *pmoy) {
*pmin = array[0];
*pmax = array[0];
float somme = 0;
for (int i = 0; i < ARRAY_SIZE; i++) {
if (array[i] < *pmin) *pmin = array[i];
if (array[i] > *pmax) *pmax = array[i];
somme += array[i];
}
*pmoy = somme / ARRAY_SIZE;
}
int main() {
srand(time(NULL));
int aleatoire_0_100 = rand() % 101;
int aleatoire_0_100_2 = rand() % 101;
int aleatoire_0_100_3 = rand() % 101;
int aleatoire_0_100_4 = rand() % 101;
int aleatoire_0_100_5 = rand() % 101;
int tab[ARRAY_SIZE] = {aleatoire_0_100, aleatoire_0_100_2, aleatoire_0_100_3, aleatoire_0_100_4, aleatoire_0_100_5 };
int min, max;
float moy;
printf("Salut!\n");
caracArray(tab, &min, &max, &moy);
printf("Les valeurs min, max et moyenne sont : %d, %d, %f\n", min, max, moy);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: