Advertisement
STANAANDREY

23p

May 8th, 2019
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int a[23][23],n,i,j,k=1;
  7.     cin>>n;
  8.     for (i=0;i<n;i++) {
  9.     for (j=i;j<n;j++){
  10.     a[i][j]=k;
  11.     a[j][i]=k;
  12.     }
  13.     k++;
  14.     }
  15.     for (i=0;i<n;i++)
  16.     {
  17.         for(j=0;j<n;j++)
  18.         cout<<a[i][j]<<' ';
  19.         cout<<endl;
  20.     }
  21.  
  22.  
  23.     /*
  24.  int a[100][100],n,i,j,x=1,nr=0;
  25.  cout<<"n=";cin>>n;
  26. for (i=0;i<n;i++) {
  27.         x=1;
  28.     for (j=0;j<n;j++) {
  29.     if (j>=n-nr)
  30.      {
  31.          a[i][j]=x;
  32.          x++;
  33.      }
  34. else
  35.     a[i][j]=1;}
  36.     nr++;
  37. }
  38. for (i=0;i<n;i++) {
  39.     for (j=0;j<n;j++)
  40.  cout<<a[i][j]<<' ';
  41.         cout<<endl;
  42. }*/
  43.     return 0;//
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement