Friday, June 4, 2021

simple program for make a series (POP) (136)

#include<iostream>

using namespace std;

int main()

{

int i,j,rows,p,q;

cout<<"please enter the number of rows:";

cin>>rows;

for(i=1; i<=rows; i++)

{

if(i%2==0)

{

p=1;q=0;

}

else

{

q=1;p=0;

}

for(j=1;j<=i;j++)

if(j%2==0)

cout<<p;

else

cout<<q;

cout<<endl;

}

} 

No comments:

Post a Comment