Advertisement
Cucura_Georgiana

Varianta 43, Subiect 2

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