using System;
class BubbleSortExample {
static void Main() {
int[] numbers = { 99, 44, 6, 2, 1, 5, 63, 87, 283, 4, 0 };
BubbleSort(numbers);
Console.WriteLine("Sorted Array:");
Console.WriteLine(string.Join(", ", numbers));
}
static void BubbleSort(int[] arr) {
bool swapped;
for (int attempts = arr.Length - 1; attempts > 0; attempts--) {
swapped = false;
for (int i = 0; i < attempts; i++) {
if (arr[i] > arr[i + 1]) {
int temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
swapped = true;
}
}
if (!swapped) break;
}
}
}