WAP in java to print
Attachments:
Answers
Answered by
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
2
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
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