fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 10;
  5.  
  6. int main() {
  7. int size, mt[MAX_SIZE + 1][MAX_SIZE + 1];
  8. cin >> size;
  9. for (int line = 1; line <= size; ++line) {
  10. for (int col = 1; col <= size; ++col) {
  11. cin >> mt[line][col];
  12. if (line > col) {
  13. int aux = mt[line][col];
  14. mt[line][col] = mt[col][line];
  15. mt[col][line] = aux;
  16. }
  17. }
  18. }
  19. for (int line = 1; line <= size; ++line) {
  20. for (int col = 1; col <= size; ++col) {
  21. cout << mt[line][col] << " ";
  22. }
  23. cout << "\n";
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5284KB
stdin
3
9 2 6
6 3 4
6 1 4
stdout
9 6 6 
2 3 1 
6 4 4