SelinD

ex7

May 23rd, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,i,j,a[25][25];
  6. cin>>n;
  7. for(i=1;i<=n;i++)
  8. {
  9. for(j=1;j<=n;j++)
  10. {
  11. if(i==1) a[i][j]=j;
  12. else if(j==n) a[i][j]=a[i-1][1];
  13. else a[i][j]=a[i-1][j+1];
  14. }
  15. }
  16. for(i=1;i<=n;i++)
  17. {
  18. for(j=1;j<=n;j++)
  19. cout<<a[i][j]<<" ";
  20. cout<<endl;
  21. }
  22. }
Add Comment
Please, Sign In to add comment