a53

GenMat22

a53
Feb 28th, 2020
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a[60][60];
  4.  
  5. int main()
  6. {
  7. int n;
  8. cin>>n;
  9. n*=3;
  10. int nr=0;
  11. for(int i=0;i<n;i+=3)
  12. for(int j=0;j<n;j+=3)
  13. ++nr,a[i][j]=nr,a[i][j+2]=nr,a[i+1][j+1]=nr,a[i+2][j]=nr,a[i+2][j+2]=nr;
  14. for(int i=0;i<n;++i,cout<<'\n')
  15. for(int j=0;j<n;++j)
  16. cout<<a[i][j]<<' ';
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment