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