0
What will the logic of print a chess in c language.
** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** it is chess of 3*3 .write code in c for n*n chess.
5 Answers
+ 2
for(unsigned i = 0; i < n; ++i){
for(unsigned j = 0; j < n; ++j){
if(2 - i&1 - j&1)
printf("**");
else
printf(" ");
}
putchar('\n');
for(unsigned j = 0; j < n; ++j){
if(2 - i&1 - j&1)
printf("**");
else
printf(" ");
}
putchar('\n');
}
+ 1
edited :)
+ 1
Hum ... Strange, it worked when I used it on Sololearn
0
I think your code is not right. Please check your condition and check your code
0
no ,when I am trying with 3 I want same pattern as I draw in question. but ur code is not drawing it .