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.
pjc97uv2f
f2b45bd12d
|
2 weeks ago | |
---|---|---|
README.md | 3 weeks ago |
README.md
#include<stdio.h> #define SIZE 9 void printSudoku(int board[SIZE][SIZE]); int main() { int board[SIZE][SIZE]={{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}}; printSudoku(board); return 0; } void printSudoku(int board[SIZE][SIZE]) { for (int i=0;i<SIZE;i++) { for(int j=0;j<SIZE;j++) { printf("%2d",board[i][j]); if((j+1)%3==0&&j<SIZE-1) { printf("|"); } } printf("\n"); if((i+1)%3==0&&i<SIZE-1) { for(int k=0;k<SIZE;k++) { if((k+1)%3==0&&k<SIZE-1) { printf("|"); } else { printf("---"); } } printf("\n"); } } }