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