Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as C# by registered user AntonisPlatis ( 3 years ago )
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]);
                
            }
            
            
                





            
        }
    } 
}

 

Revise this Paste

Your Name: Code Language: