Compare commits
No commits in common. "bouton" and "master" have entirely different histories.
1 changed files with 0 additions and 41 deletions
41
TD1.c
41
TD1.c
|
@ -1,41 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
int dim=3;
|
|
||||||
int tab[3];
|
|
||||||
|
|
||||||
void afficherTableau (int tab [], int dim)
|
|
||||||
{
|
|
||||||
int i ;
|
|
||||||
for (i=0;i<dim;i++)
|
|
||||||
{ printf ("%d", tab[i]);
|
|
||||||
printf ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int c ;
|
|
||||||
int compteur=1;
|
|
||||||
int i;
|
|
||||||
tab[0]=1;
|
|
||||||
tab[1]=3;
|
|
||||||
tab[2]=2;
|
|
||||||
|
|
||||||
|
|
||||||
while (compteur!=0)
|
|
||||||
{
|
|
||||||
compteur=0;
|
|
||||||
for (i=0;i<dim;i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(tab[i+1]<tab[i])
|
|
||||||
{
|
|
||||||
c=tab[i+1];
|
|
||||||
tab[i+1]=tab[i];
|
|
||||||
tab[i]=c;
|
|
||||||
compteur++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
afficherTableau(tab,dim);
|
|
||||||
}
|
|
Loading…
Reference in a new issue