You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
#include <stdio.h>
|
|
|
|
void print_sudoku(char sudoku[9][9]) {
|
|
for (int i = 0; i < 9; i++) {
|
|
if (i % 3 == 0 && i != 0) {
|
|
printf("-------------------------\n");
|
|
}
|
|
for (int j = 0; j < 9; j++) {
|
|
if (j % 3 == 0 && j != 0) {
|
|
printf("| ");
|
|
}
|
|
printf("%c ", sudoku[i][j]);
|
|
}
|
|
printf("\n");
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
char sudoku_board[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', '0', '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_board);
|
|
|
|
return 0;
|
|
}
|