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