52. Program that generates the following checker board by using loop.

Chapter 6: 

Looping Structures

Programming Exercise

Problem # 52:

Write a program that generates the following checker board by using loop.
     --------
    --------
     --------
    --------
     --------
    --------

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    int i, j;
    for(i=1;i<=8;i++)
    {
        if(i%2!=0)
        cout<<" ";
            for(j=1;j<=8;j++)
            cout<<"-";
        cout<<endl;
    }
}

Output:

Chapter 6, Coding tutorial, Computer Science, CPP Basics, Exercise Solution, IT Series, Looping Structures, Object Oriented Programming using C++, Programming for beginners, Programming Tutorial

Let me know in the comment section if you have any question.

Previous Post:
51. Program to display the following output using loop.

Comments