SUDOKU CHECKING PROGRAM

A Sudoku is a number placement puzzle ,it has 9*9 rows and columns . the rule is that any row or column should not contain similar value if any of the element contain same value then that Sudoku is not right. here a program is given to show this:
 

#include<stdio.h>
#include<conio.h>
void main()
{
int k,i,j,a[9][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};
static int f;
for(k=0;k<9;k++)
{
for(j=k;j<9;j++)
{
for(i=0;i<9;i++)
{
if(a[i][j]==a[i][j+1])
{ f=1;
break;
}
else

if(a[i][j]==a[i+1][j])
{ f=1;
break;
}
}
}
}
if(f==1)

printf("sudoku is not right");
else
printf("sudoku is right");

}


Comments

Popular posts from this blog

Pre-compiled Headers

CONNECTING WITH FTP-FILE TRANSFER PROTOCOL

PROBING THE INTERNET WITH TELNET: