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