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