#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main() {
    int taille;
    printf("veuillez entrer votre taille:\n");
    scanf("%d",&taille);
    int tab[taille];
     srand(time(NULL));
    for(int i=0;i<taille;i++) {
        tab[i]=rand()%(taille+1);
       printf("%d\n",tab[i]);
    }

  int max=tab[0],min=tab[0];
     for(int i=1;i<taille;i++) {
       if(tab[i]>max){
             max=tab[i];}
        if(tab[i]<min){
            min=tab[i];}
      }

int x,recherche,test;
  printf("veuillez entrer votre valeur\n");
  scanf("%d",&x);
    for(int i=0;i<taille;i++){
        test++;
      if(x==tab[i]){
         recherche=1;
          break;
       } 
    }

      printf("max=%d\n",max);
      printf("min=%d\n",min);
    
       if(recherche==1)
      printf("la valeur %d est representer dans le tableau apres %d test",x,test);
    
      else 
       printf("la valeur %d n'exicte pas dans le tableau",x);

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: