Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BubbleSort
- {
- class Program
- {
- public static void Main()
- {
- int[] odd = new int[6] { 99, 97, 95, 87, 77, 93 };
- bool swapped = true;
- while (swapped == true)
- {
- swapped = false;
- for (int y = 0; y < odd.Length - 1; y++)
- {
- if (odd[y] > odd[y + 1])
- {
- swapped = true;
- int temp = odd[y];
- odd[y] = odd[y + 1];
- odd[y + 1] = temp;
- }
- }
- }
- foreach (int item in odd)
- {
- Console.Write($"{item:D2} ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement