Advertisement
SelinD

V86s2e5

Mar 12th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int a[25][25];
  4. int main()
  5. {
  6. int n,par=2,impar=1,i,j;
  7. cin>>n;
  8. for(i=1;i<=2*n;i++)
  9. {
  10. if(i%2==0)
  11. {
  12. for(j=2*n;j>=1;j--)
  13. {
  14. a[i][j]=par;
  15. par=par+2;
  16. }
  17. }
  18. else
  19. {
  20. for(j=1;j<=2*n;j++)
  21. {
  22. a[i][j]=impar;
  23. impar=impar+2;
  24. }
  25. }
  26. }
  27. for(i=1;i<=2*n;i++)
  28. {
  29. for(j=1;j<=2*n;j++)
  30. cout<<a[i][j]<<" ";
  31. cout<<endl;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement