Browse Source

algorytm-sortowania

algorytm-sortowanie
MateuszK 5 years ago
parent
commit
8f5e84c38c
  1. 43
      sortowanie/Program.cs
  2. 8
      sortowanie/Szkola.csproj

43
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] + ",");
}
}
}
}

8
sortowanie/Szkola.csproj

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
Loading…
Cancel
Save