using System;
namespace Array_Sorting
{
internal class Program
{
public static void Main()
{
int i;
int j;
int temp;
Random tyxaios = new Random();
int[] pinakas = new int[10];
for (i = 0; i < 10; i++)
{
pinakas[i] = tyxaios.Next(1, 100);
}
Console.WriteLine("print table ------");
for (i = 0; i < 10; i++)
{
Console.WriteLine(pinakas[i]);
}
Console.WriteLine("print alter table ------");
for (i = 0; i < 10; i+=2)
{
Console.WriteLine(pinakas[i]);
}
for (j = 0; j <= pinakas.Length - 2; j++)
{
for (i = 0; i <= pinakas.Length - 2; i++)
{
if (pinakas[i] > pinakas[i + 1])
{
temp = pinakas[i + 1];
pinakas[i + 1] = pinakas[i];
pinakas[i] = temp;
}
}
}
Console.WriteLine("print sorted table ------");
for (i = 0; i < 10; i++)
{
Console.WriteLine(pinakas[i]);
}
}
}
}
Add a code snippet to your website: www.paste.org