From 8f5e84c38c0347f383758543c60c6c30d8a450e1 Mon Sep 17 00:00:00 2001 From: MateuszK Date: Tue, 4 May 2021 15:51:57 +0200 Subject: [PATCH] algorytm-sortowania --- sortowanie/Program.cs | 43 ++++++++++++++++++++++++++++++++++++++++ sortowanie/Szkola.csproj | 8 ++++++++ 2 files changed, 51 insertions(+) create mode 100644 sortowanie/Program.cs create mode 100644 sortowanie/Szkola.csproj diff --git a/sortowanie/Program.cs b/sortowanie/Program.cs new file mode 100644 index 0000000..0149d3a --- /dev/null +++ b/sortowanie/Program.cs @@ -0,0 +1,43 @@ +using System; + +namespace szkola_2._0 +{ + + class Program + { + + public static void sortowanie() + { + + } + + static void Main(string[] args) + { + int[] sort = {21, 14, 1, 66, 45}; + + int length = 5; + do + { + for(int i=0; i<4; i++) + { + if(sort[i]>sort[i+1]) + { + int support = sort[i]; + sort[i] = sort[i+1]; + sort[i+1] = support; + } + } + length--; + } + while(length>1); + for(int j = 5 - 1; j >= 0; j--) + { + Console.Write(sort[j] + ","); + } + } + + + + + } +} diff --git a/sortowanie/Szkola.csproj b/sortowanie/Szkola.csproj new file mode 100644 index 0000000..2082704 --- /dev/null +++ b/sortowanie/Szkola.csproj @@ -0,0 +1,8 @@ + + + + Exe + net5.0 + + +