#include #include #include int main() { int a[9][9] = { 0 }; int i, j, k; srand(time(NULL)); printf("|-------------------|\n"); for (i = 0; i < 9; i++) { for (j = 0; j < 9; j++) { if (j % 3 == 0) printf("|"); if (rand() % 3 == 0) { do { k = rand() % 9 + 1; } while (a[i][k - 1] != 0); a[i][k - 1] = k; printf("%d", k); } else { a[i][j] = 0; printf("."); } if (j == 8) printf("|"); printf(" "); } printf("\n"); if ((i + 1) % 3 == 0) printf("|-------------------|\n"); } return 0; }