From 64df25e19e41985b8655cf1b4160e1d2df2301da Mon Sep 17 00:00:00 2001 From: pmfsq5yrv <1159971203@qq.com> Date: Sat, 2 Nov 2024 09:41:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E9=A2=98=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- print_grid.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 print_grid.c diff --git a/print_grid.c b/print_grid.c new file mode 100644 index 0000000..1c21969 --- /dev/null +++ b/print_grid.c @@ -0,0 +1,17 @@ +#include + +void printGrid(int grid[9][9]) { + int i, j; + for (i = 0; i < 9; i++) { + for (j = 0; j < 9; j++) { + printf("%2d ", grid[i][j]); + if ((j + 1) % 3 == 0 && j < 8) { + printf("| "); + } + } + printf("\n"); + if ((i + 1) % 3 == 0 && i < 8) { + printf("-----------------------\n"); + } + } +}