
{filelink=18435}
using System;
public class ExempleMethTableau
{
static public void Main ()
{
Random rand = new Random((int)DateTime.Now.Millisecond);
int [] monTableau = new int [5];
for (int x = 0; x < monTableau.Length; ++x)
{
monTableau [x] = rand.Next () % 101;
}
Console.WriteLine ("Les éléments du tableau Non trié:");
foreach (int x in monTableau)
{
Console.WriteLine (x + " ");
}
Array.Sort(monTableau);
Console.WriteLine ("Tableau trié en ordre croissant:");
foreach (int x in monTableau)
{
Console.WriteLine (x + " ");
}
Array.Reverse (monTableau);
Console.WriteLine ("Tableau trié en ordre décroissant:");
foreach (int x in monTableau)
{
Console.WriteLine (x + " ");
}
}
}