#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<vector<int>> sub;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            vector<int> v;
            for(int k=i;k<=j;k++){
                v.push_back(a[k]);
            }
            sub.push_back(v);
        }
    }
    for(int i=0;i<sub.size();i++){
        for(int j=0;j<sub[i].size();j++){
            cout<<sub[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: