#include iostream #include iomanip using namespace std; int main() { int n; cin n; // 外层循环遍历每一行 for (int i 0; i n; i) { // 内层循环遍历每一列 for (int j 0; j n; j) { if (j i) { // 左上区域输出5个宽度的空白 cout setw(5) ; } else { // 对角线和右下数字i-j1 cout setw(5) (i - j 1); } } cout endl; } return 0; }