Print Friendly and PDF
(Checkerboard Pattern) Display the following checkerboard pattern with eight output statements, then display the same pattern using as few statements as possible.
(Checkerboard Pattern) Display the following checkerboard pattern with eight output statements, then display the same pattern using as few statements as possible.

Solution:  
 
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
 
int main()
{
  cout << "* * * * * * * * \n";
  cout << " * * * * * * * *\n";
  cout << "* * * * * * * * \n";
  cout << " * * * * * * * *\n";
  cout << "* * * * * * * * \n";
  cout << " * * * * * * * *\n";
  cout << "* * * * * * * * \n";
  cout << " * * * * * * * *\n";
   cout << endl;
  cout << "* * * * * * * * \n * * * * * * * *\n* * * * * * * * \n * * * * * * * *\n* * * * * * * * \n * * * * * * * *\n* * * * * * * * \n * * * * * * * *\n";
 
 
   return 0;
}
 
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: