Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SortowanieBabelkowe
- {
- class Program
- {
- static void Sortowanie(int[] tab)
- {
- int n = tab.Length;
- do
- {
- for (int i = 0; i < n - 1; i++)
- {
- if (tab[i] > tab[i + 1])
- {
- int temp = tab[i];
- tab[i] = tab[i + 1];
- tab[i + 1] = temp;
- }
- }
- n--;
- } while (n > 1);
- }
- static void Main(string[] args)
- {
- int[] tab = { 4, 1, 5, 3, 2 };
- Sortowanie(tab);
- foreach (var item in tab)
- {
- Console.Write(item + " ");
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement