constint n = 10 ;
///////////////////// **** for loop **** ////////////////////////////
for( int i = 1 /* for-init-statement */ ; i <= n /* condition */ ; i++ /* expression */ )
{
//// for-loop body starts here ////
if(i < 5 && i != 2)
{
cout << 'X';
}
//// for-loop body ends here ////
} // scope of i has ended here
///////////////////// **** while loop **** ////////////////////////////
{ // need an extra block to limit the scope of i
int i = 1 ; /* for-init-statement */
while( i <= n ) /* condition */
{
//// for-loop body starts here ////
if(i < 5 && i != 2)
{
cout << 'X';
}
//// for-loop body ends here ////
i++ ; /* expression */
}
} // scope of i has ended here