Wave print of a 2D array

#include
#include
using namespace std;
int wave(int arr[][1000],int i, int j)
{
int col,row;
for(col=0;col<i;col++){
if(col%2==0){
for(row=0;row<j;row++){
cout<<arr[row][col]<<",";
}
}
else{
for(row=j-1;row>=0;row–){
cout<<arr[row][col]<<",";
}
}
}
return 0;
}

int main()
{
int n,i,j;
int a[1000][1000];
int m;
cin>>n>>m;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
cin>>a[i][j];
}
}
wave(a,n,m);
}

How to add “END” at the end of this.

hi @sawsouravkr_f85fc786157b1e79
I have corrected ur code -->


It’s working fine and passing all test cases… and kindly when u share ur code kindly save in on coding blocks ide and then send link…

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.

@sawsouravkr_f85fc786157b1e79 what’s the issue?
just write cout<<“END”; after function call