59 (2).PNG

#include<iostream.h>
#include<conio.h>
void main()
{
                int i,j,n;
                clrscr();
                cout<<"Enter The Number of Line :- ";
                cin>>n;
                for(i=1;i<=n;i++)
                                {
                                cout<<endl;
                                for(j=1;j<=i;j++)
                                                {
                                                if((i+j)%2==0)
                                                                {
                                                                cout<<"1 ";
                                                                }
                                                else
                                                                {
                                                                cout<<"0 ";
                                                                }
                                                }
                                }
                getch();
}

59.PNG

Advertisements