My output is not matching (generating subarray)

#include
using namespace std;
int main() {
int n;
cin>>n;
int a[1000];
for(int i=0;i<n;i++)
{
cin>>a[i];
}

for(int i=0;i<n;i++)
{
for(int j=i;j<n;j++)
{
for(int k=j;k<=j;k++)
{
cout<<a[k]<<",";
}

     cout<<endl;      
  }    

}

}

hey @mayankjindal40, please share problem link

not sol, problem link i want to see what is the expected output

here it should be k=i


i want this type of output

@mayankjindal40, it will give this output, just apply suggested changes to ur code

please tell me the changes that i have to do.

@mayankjindal40, already told you

thank you for solving my doubt

Welcome :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.