A
anand devarajan
#include"stdio.h"
#include<conio.h>
#include<math.h>
void main()
{
int row,result;
char col;
clrscr();
printf("enter the row\n");
scanf("%d",&row);
printf("enter the col\n");
scanf("%d",&col);
result=row+col;
if(result<96||result>110)
printf("not valid");
else
{
if(result%2==0)
printf("black");
else
printf("white");
}
getche();
}
this is my prg for color of the squares in chess board i dont know wats
the mistake in this its not getting executed correctly i want this prg
to get the square name eg:a1 from the user and display the output that
it is whether black or white i had initialised col as char and made it
as ascii value using %d in scanf and thus using it in result i even
want a if statement to print the invalid statement if the inout given
is not valid eg:char >h and num>8
#include<conio.h>
#include<math.h>
void main()
{
int row,result;
char col;
clrscr();
printf("enter the row\n");
scanf("%d",&row);
printf("enter the col\n");
scanf("%d",&col);
result=row+col;
if(result<96||result>110)
printf("not valid");
else
{
if(result%2==0)
printf("black");
else
printf("white");
}
getche();
}
this is my prg for color of the squares in chess board i dont know wats
the mistake in this its not getting executed correctly i want this prg
to get the square name eg:a1 from the user and display the output that
it is whether black or white i had initialised col as char and made it
as ascii value using %d in scanf and thus using it in result i even
want a if statement to print the invalid statement if the inout given
is not valid eg:char >h and num>8