Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int m[50][50],n,i,j,c;
- cin>>n;
- for (i=0; i<n; i++)
- for (j=0; j<n; j++)
- cin>>m[i][j];
- cout<<endl;
- for (j=0; j<n; j++)
- {
- i=0;
- c=j;
- if (i==c)
- continue;
- else
- while (c<n)
- {
- cout<<m[i][c]<<' ';
- i++;
- c++;
- }
- cout<<endl;
- }
- cout<<endl;
- for (i=0; i<n; i++)
- {
- c=i;
- j=0;
- if (c==j)
- continue;
- else
- while (c<n)
- {
- cout<<m[c][j]<<' ';
- c++;
- j++;
- }
- cout<<endl;
- }
- cout<<endl;
- for (j=0; j<n; j++)
- {
- i=0;
- c=j;
- if (c==n-i-1)
- continue;
- else
- while (c>-1)
- {
- cout<<m[i][c]<<' ';
- c--;
- i++;
- }
- cout<<endl;
- }
- cout<<endl;
- for (i=0; i<n; i++)
- {
- j=n-1;
- c=i;
- if (j==n-i-1)
- continue;
- else
- while (c<n)
- {
- cout<<m[c][j]<<' ';
- c++;
- j--;
- }
- cout<<endl;
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement