Question: Write a C program to check the validity of a Sudoku solution. Follow the link to know more about Sudoku: https://sudoku.com/how-to-play/sudoku-rules-for-complete-beginners/ You must at least
Write a C program to check the validity of a Sudoku solution. Follow the link to know more about Sudoku: https://sudoku.com/how-to-play/sudoku-rules-for-complete-beginners/
You must at least do the following:
Ask the user to provide a minimum of first two rows of the Sudoku grid. For the rest of the entries, you should use random number generator;
It should be a console-based, yet convenient and intuitive user interface to get first two rows of Sudoku grid from the user. Use data validation to ensure user enters exactly nine distinct and valid integers, for example, no duplicate or non-numeric values or integers less than 1 or greater than 9 should be accepted; 3- Use appropriate logic to make sure random number generator generates distinct set of valid integers!
You should use multi-dimensional array to represent the grid;
Once the grid is fully populated, display the grid in a 9 x 9 matrix format, followed by your decision of whether it forms a valid Sudoku solution or not;
As a test case, your code should pass the following grid to your validity test and you must display its decision i.e. whether the following grid is a valid solution or not BEFORE taking any user input.
For your convenience, I have provided above 2-D arrays declaration/initialization below, which you can copy/paste to your code:
int testGrid[ ][ 9 ] = {{5,3,4,6,7,8,9,1,2}, {6,7,2,1,9,5,3,4,8},{1,9,8,3,4,2,5,6,7},
{8,5,9,7,6,1,4,2,3},{4,2,6,8,5,3,7,9,1},{7,1,3,9,2,4,8,5,6},
{9,6,1,5,3,7,2,8,4},{2,8,7,4,1,9,6,3,5},{3,4,5,2,8,6,1,7,9}};69
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
