Dizzy3113

Untitled

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