This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
lessons/C++/lesson3/task5.cpp
2023-07-16 13:23:25 +00:00

24 lines
455 B
C++

#include <iostream>
int main() {
int a[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
std::cout << a[i][j] << ' ';
}
std::cout << '\n';
}
std::cout << '\n';
std::swap(a[0], a[2]);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
std::cout << a[i][j] << ' ';
}
std::cout << '\n';
}
}