Computer Science, asked by Abhinav0181, 10 months ago

WAP in java to print ​

Attachments:

Answers

Answered by ayaan12396
2

Answer:

I am giving you the answer pls become my follower

//Answer begins

public class Pattern

{

public static void main()

{

int a,b;

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

{

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

{

if(j%2==0)

System.out.print("0");

else

System.out.print("1");

}

System.out.println();

}

}

Answered by anindyaadhikari13
2

\star\:\:\:\sf\large\underline\blue{Question:-}

Write a program in Java to display the following pattern.

1

1 0

1 0 1

1 0 1 0

1 0 1 0 1

\star\:\:\:\sf\large\underline\blue{Answer:-}

Here is the code given below.

class Pattern

{

public static void main(String s[])

{

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

{

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

System.out.print(j%2+" ");

System.out.println();

}

}

}

Similar questions