Advertisement
STANAANDREY

mat_sq(pb23)

May 10th, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int n,i,j,a[100][100],k;
  7.  
  8. cin>>n;
  9. for (i=0;i<n;i++)
  10. {
  11.     k=i+1;
  12.     for (j=n-1;j>=0;j--)
  13.     {
  14.         a[i][j]=k;
  15.         if (k>1)
  16.             k--;
  17.     }
  18. }
  19.  
  20. for (i=0;i<n;i++) {
  21.     for (j=0;j<n;j++)
  22.   cout<<a[i][j]<<' ';
  23.   cout<<endl;
  24. }
  25.   return EXIT_SUCCESS;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement