when i output top down approach for even columns, an extra zero is being outputted in the end of that column
Wrong answer in the output
@kamakshi.behl22
hello kamakshi,
pls save ur code on https://ide.codingblocks.com/ and share the generated link
//when i output top down approach for even columns, an extra zero is there in the end of that column
#include
using namespace std;
int main() {
int r,c;
cin>>r;
cin>>c;
int a[10][10];
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin>>a[i][j];
}
}
for(int i=0;i<c;i++){
if(i%2==0){
for(int j=0;j<r;j++){
cout<<a[j][i]<<",";
}
}
else
for(int j=r;j>=0;j--){
cout<<a[j][i]<<",";
}
}
cout<<"END";
return 0;
}