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