ALGO

Bonjour,c lila
donnée un algorithme qui permet de trié dans l'ordre croissant les élément d'un vecteur de 30entier.
Configuration: Windows Vista
Internet Explorer 7.0

2 réponses

  • Votes
  • Date
  • Date décroissante
  1. algorithmme tri;
    var t:tableau [1..100]d'entier;
    x,i,j,n:entier;
    debut
    lire(n);{la taille de tab}
    pour i:=1 à n-1 fair
    pour j:=i+1 à n fair
    si t[i]>t[j] alors
    x:=t[i];
    t[i]:=t[j];
    t[j]:=x;
    fair;
    pour i:=1 à n fair
    ecrir(t[i]);
    1. const N=30

      procedue trier(tab[N] entier)
      debut
      var i :entier
      temp:entier
      for i:=1 to N-1 do
      for j:=2 to N do
      if tab[i]>tab[j] then
      temp:=tab[i]
      tab[i]:=tab[j]
      tab[j]:=temp
      finif
      ffor
      ffor
      fproc