// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
void bubble_sort(int a[]){
    // int ar[7]=a[7];
    for(int i=0;i<7;i++){
        for(int j=0;j<7-i-1;j++){
            if(a[j]>a[j+1]){
                int temp=a[j];
                a[j]=a[j+1];
                a[j+1]=temp;
            }
        }
        for(int k=0;k<7;k++){
                cout << a[k] << " "; }
        cout << endl;
    }
    
    // printing sorted array
    cout << "Array after implementing bubble sort to it : ";
    for(int i=0;i<7;i++){
        cout << a[i] << " ";
    }
}
int main() {
    int arr[7];
    cout << "Enter elements of array : ";
    for(int i=0;i<7;i++){
        cin>> arr[i];
    }
    bubble_sort(arr);
    return 0;
    
}
