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