#include <iostream> #include <iomanip> using namespace std; int main() { int N; cin >> N; if (N <= 0 || N >= 10) { cout << "Invalid input. Please enter a number between 1 and 9." << endl; return 1; } for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) { int value = N - abs(i - j); cout << setw(3) << value; } cout << endl; } return 0; } /************************************************************** Problem: 1195 User: zhenghaoxuan Language: C++ Result: Accepted Time:10 ms Memory:2072 kb ****************************************************************/