Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {int N,A[200][200],x;
  7. cin>>N;
  8. for(int i=1;i<=N;i++)
  9. for(int j=1;j<=N;j++)
  10. cin>>A[i][j];
  11. for(int i=1;i<=N;i++)
  12. if(i%2==0)
  13. for(int j=i,x=1;j>0;j--,x++)
  14. cout<<A[j][x]<<" ";
  15. else
  16. for(int j=i,x=1;j>0;j--,x++)
  17. cout<<A[x][j]<<" ";
  18. for(int j=2;j<=N;j++)
  19. if(j%2!=N%2)
  20. for(int i=j,x=N;i<=N;i++,x--)
  21. cout<<A[x][i]<<" ";
  22. else
  23. for(int i=j,x=N;i<=N;i++,x--)
  24. cout<<A[i][x]<<" ";
  25. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement