Computer Science, asked by gundjambanna68, 23 hours ago

Write a java program on this pattern


1
0 1
0 1 0
1 0 1 0
1 0 1 0 1

Answers

Answered by MissRudeGirl
1

public class KboatPattern

{

public void displayPattern() {

int a = 1, b = 0;

for (int i = 1; i <= 5; i++) {

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

if (j % 2 == 0)

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

else

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

}

System.out.println();

}

}

}

output is given in the attachment

output is given in the attachmentkindly refer it

output is given in the attachmentkindly refer ithope it helps yo

Attachments:
Answered by laxmansinghr251
0

Answer:

101010101010101010101

Similar questions