print all subarrays

 #include <iostream>

#include <bits/stdc++.h>

#include <climits>


using namespace std;




void display(int *arr, int n){


    for(int i=0;i<n;i++){


        cout<<arr[i];


    }


}






int main() {

    int arr[]={1,2,3,8};

    int n=sizeof(arr)/sizeof(int);

    for(int i=0;i<n;i++){

        for(int j=i;j<n;j++){

            for(int k=i;k<=j;k++){

                cout<<arr[k]<<" ";

            }

            cout<<endl;

        }

    }

    



    return 0;


}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings