#include <iostream>
using namespace std;
void display( int arr[], int n ){
for ( int i = 0; i < n; i++ ) {
cout << arr[i] << ", ";
}
}
void swap ( int &a, int &b ){
int temp = a;
a = b;
b = temp;
}
void solve( int arr[], int n ){
int i, j;
for ( i = 0; i < n; i++ ) {
for ( j = 0; j < n-1; j++ ) {
if ( arr[j] > arr[ j+1 ] ) {
swap( arr[j], arr[ j + 1 ] );
}
}
}
}
int main(){
int arr[] = {8, 45, 74, 12, 10, 36, 58, 96, 5, 2, 78, 44, 25, 12, 89, 95, 63, 84};
int n = sizeof( arr ) / sizeof( arr[0] );
cout << "Array before sorting: ";
display(arr, n);
solve( arr, n );
cout << "\nArray After sorting: ";
display(arr, n);
}