coding can change the life of billion people on the world...!!!

#includeusing namespace std;int main(){ int var,n=5; for(int i=1;i<=n;i++) { if(i%2==0) { var=0; } else { var=1; } for(int j=1;j<=i;j++) { if(var == 0) {var=1;} else {var=0;} cout<<""<<var; } cout<<endl; }}??????

superb logic @Rikung......

#include

ReplyDeleteusing namespace std;

int main()

{

int var,n=5;

for(int i=1;i<=n;i++)

{

if(i%2==0)

{

var=0;

}

else

{

var=1;

}

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

{

if(var == 0)

{var=1;}

else

{var=0;}

cout<<""<<var;

}

cout<<endl;

}

}

??????

superb logic @Rikung......

Delete