series-11

1

0 1

1 0 1

0 1 0 1


 class series

{

public static void main(String args[])

{


for(int r=1;r<=4;r++)

{

for (int c=1 ; c<=r ; c++)

{

if((r+c)%2==0)

System.out.print(1+ "  ");

else

System.out.print(0+"  ");

}

System.out.println() // to come to next line

}

}

}


// common way

class series

{

public static void main(String args[])

{

int d=1; // how many element in first line

for(int r=1;r<=4;r++)

{

for (int c=1 ; c<=d ; c++)

{

if((r+c)%2==0)

System.out.print(1+ "  ");

else

System.out.print(0+"  ");

}

d++;

System.out.println() // to come to next line

}

}

}


Comments

Post a Comment

Popular posts from this blog