Browse Source

Update Program.cs

poprawki
algorytm-sortowanie
MateushK 5 years ago
parent
commit
28cbb45890
  1. 24
      sortowanie/Program.cs

24
sortowanie/Program.cs

@ -1,24 +1,17 @@
using System; using System;
namespace szkola_2._0 namespace szkola_2._0;
{ {
class Program class Program
{ {
public static void sortowanie() public static void sortowanie(int[] sort;)
{ {
int length = sort.length;
}
static void Main(string[] args)
{
int[] sort = {21, 14, 1, 66, 45};
int length = 5;
do do
{ {
for(int i=0; i<4; i++) for(int i=0; i<length-1; i++)
{ {
if(sort[i]>sort[i+1]) if(sort[i]>sort[i+1])
{ {
@ -30,12 +23,19 @@ namespace szkola_2._0
length--; length--;
} }
while(length>1); while(length>1);
for(int j = 5 - 1; j >= 0; j--) for(int j = length-1; j >= 0; j--)
{ {
Console.Write(sort[j] + ","); Console.Write(sort[j] + ",");
} }
} }
static void Main(string[] args)
{
int[] sortowanie = {21, 14, 1, 66, 45};
sortowanie(sortowanie[]);
}

Loading…
Cancel
Save