Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {int N,A[200][200],x;
- cin>>N;
- for(int i=1;i<=N;i++)
- for(int j=1;j<=N;j++)
- cin>>A[i][j];
- for(int i=1;i<=N;i++)
- if(i%2==0)
- for(int j=i,x=1;j>0;j--,x++)
- cout<<A[j][x]<<" ";
- else
- for(int j=i,x=1;j>0;j--,x++)
- cout<<A[x][j]<<" ";
- for(int j=2;j<=N;j++)
- if(j%2!=N%2)
- for(int i=j,x=N;i<=N;i++,x--)
- cout<<A[x][i]<<" ";
- else
- for(int i=j,x=N;i<=N;i++,x--)
- cout<<A[i][x]<<" ";
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement