i still very newbie, and i was working on this simple project. basically we have to display a checkerboard pattern like this :
Code:
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
with only using these tree output statements once :
Code:
printf ( "* " );
printf ( " " );
printf ( "\n" );
this is my progress this far, can anyone tell me what is my mistake ?
Code:
#include <stdio.h>
main ()
{
int row = 1; // declare the interger
int column; // declare the 2nd interger
while ( row <= 8 ) { // open curly bracket for the 1st 'while'
column = 1; // declare the value of interger
while ( column <= 8 ) { // open curly bracket for the 2nd 'while'
printf ( "* " );
column++;
if ( row % 2 == 0 && column == 2 ) { // open curly bracket for 'if'
printf ( " " );
} // close bracket for 'if'
}// close bracket for inner 'while'
row++ ;
printf( "\n" );
} // close bracket for outer 'while'
return 0;
}
that's all ! thx !