Welcome, guest! Login / Register - Why register?
[email protected] webmail now available. Want one? Go here.
Windows getting boring or just want to try something Open Source for your next Desktop Environment?! Go Zorin OS.

Paste

Pasted as C# by registered user AntonisPlatis ( 1 year 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: