# Sudoku

Discussion in 'C' started by bc.jat11, Sep 26, 2011.

1. ### bc.jat11New Member

Joined:
Sep 26, 2011
Messages:
4
0
Trophy Points:
0
Occupation:
Student
Location:
Deesa,Gujarat,India.
Code:
```/*********************************\
The Program for Cross sum sudoku.
Date: 20-10-2011
Devloped by:Balvant C Jat
Contact:-+919537718497
\*********************************/
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
int a,b,c,d,i,j,f,g,x,y,t;         /*all variable declaration*/
top:
clrscr();
f=2,g=12;
x=20,y=16;
_setcursortype(_NORMALCURSOR);
printf("\n Enter the SUM which is devided by 3:");
scanf("%d",&b);                          /* Number scaned for cross sum*/
if(b%3==0)          /* Checks that given no is devided by column*/
{
c=(9-1)/2;        /*Total box-1 divided by 2 and store result in c*/
d=b/3;            /* given no devided by column and store reslut in d*/
i=d-c;           /* create starting point by d-c */
t=d;            /* t for position */
for(j=0;t>0;j++)      /* This for loop for length of output digit */
{
t/=10;
}
/* This if ladden is define position of output
digit*/
if(j==3)
x=19;
else if(j==5)
x=18;
t=8;
clrscr();
gotoxy(x+t,y);
printf("%d",i++);
gotoxy(x+2*t,y+2*t);
printf("%d",i++);
gotoxy(x,y+t);
printf("%d",i++);
gotoxy(x,y+2*t);
printf("%d",i++);
gotoxy(x+t,y+t);
printf("%d",i++);
gotoxy(x+2*t,y);
printf("%d",i++);
gotoxy(x+2*t,y+t);
printf("%d",i++);
gotoxy(x,y);
printf("%d",i++);
gotoxy(x+t,y+2*t);
printf("%d",i++);
_setcursortype(_NOCURSOR);
sleep(1);
/* The below for loop is used for draw boxes */
for(i=0;i<4;i++)
{
gotoxy(17,g);
for(j=1;j<25;j++)
{
printf("%c",f);
}
g+=8;
sleep(1);
}
g=16;
for(i=0;i<4;i++)
{
c=12;
gotoxy(g,c);
for(j=1;j<26;j++,c++)
{
gotoxy(g,c);
printf("%c",f);
}
g+=8;
sleep(1);
}
}
else
printf("\n Entered sum must be devided by 3.");
getch();
gotoxy(16,45);
printf("Press ");
cprintf("ESC ");
printf("to exit. Otherwise press any key...");
if(getch()!=27)
goto top;
else
exit(0);
}```

Joined:
Jul 12, 2004
Messages:
15,296