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.

32 lines
592 B

#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;
}