fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 100;
  5. int main() {
  6. int n, mt[MAX_SIZE + 1][MAX_SIZE + 1];
  7. cin >> n;
  8. for(int i = 1; i <= n; ++i) {
  9. for( int j = 1; j <= n; ++j) {
  10. cin >> mt[i][j];
  11.  
  12. }
  13. }
  14. int aux = 0;
  15. for(int i = 1; i <= n; ++i) {
  16. for( int j = 1; j <= n; ++j) {
  17. if(i < j && i + j <= n) {
  18. aux = mt[j][n];
  19. mt[j][n] = mt[i][j];
  20.  
  21. }
  22.  
  23. }
  24.  
  25.  
  26. }
  27. for (int i = 1; i <= n; ++i) {
  28. for (int j = 1; j <= n; ++j) {
  29. cout << mt[i][j] <<" ";
  30. }
  31. cout <<" \n";
  32. }
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5296KB
stdin
5
11 12 13 14 15
21 22 23 24 25
31 32 33 34 35
41 42 43 44 45
51 52 53 54 55
stdout
11 12 13 14 15  
21 22 23 24 12  
31 32 33 34 23  
41 42 43 44 14  
51 52 53 54 55