I have a array with random elements. there is 10 element in array.
how to set this numbers in second array from min to max.
examle array (43, 2, 23, 45...) in second array must be (2, 23, 43, 45...)
code c#
int[] mass = new int[10];
int[] mass2 = new int[10];
void shemtxvevitimasivi()
{
label1.Text = "";
Random r = new Random();
for (int i=0; i<mass.Length; i++)
{
mass[i] = r.Next(0, 100);
}
for (int k=0; k<mass.Length; k++)
{
label1.Text+=mass[k].ToString()+" | ";
}
}
void minim()
{
for (int t = 0; t < mass.Length; t++)
{
label2.Text = mass.Min().ToString() + " | ";
}
}
private void button1_Click(object sender, EventArgs e)
{
minim();
}
private void Form1_Load(object sender, EventArgs e)
{
shemtxvevitimasivi();
}
Aucun commentaire:
Enregistrer un commentaire