parent
29628da8b3
commit
bd90efcd6d
@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void print_sudoku(int matrix[9][9]) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
printf("%d ", matrix[i][j]);
|
||||
if ((j + 1) % 3 == 0 && j != 8) {
|
||||
printf("| ");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
if ((i + 1) % 3 == 0 && i != 8) {
|
||||
printf("------+-------+------\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int sudoku_matrix[9][9] = {
|
||||
{5, 3, 0, 0, 7, 0, 0, 0, 0},
|
||||
{6, 0, 0, 1, 9, 5, 0, 0, 0},
|
||||
{0, 9, 8, 0, 0, 0, 0, 6, 0},
|
||||
{8, 0, 0, 0, 6, 0, 0, 0, 3},
|
||||
{4, 0, 9, 8, 0, 3, 0, 0, 1},
|
||||
{7, 0, 0, 0, 2, 0, 0, 0, 6},
|
||||
{0, 6, 0, 0, 0, 0, 2, 8, 0},
|
||||
{0, 0, 0, 4, 1, 9, 0, 0, 5},
|
||||
{0, 0, 0, 0, 8, 0, 0, 7, 9}
|
||||
};
|
||||
|
||||
print_sudoku(sudoku_matrix);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in new issue