Program :-
write a java program to print the following pattern.
1
1 0
1 O 1
1 0 1 0
1 0 1 0 1
Please answer it very fast
Answers
Answered by
2
class he
{
public static void main(int n)
{
for(int i = 1;i <=n;i++)
{
for(int j = 1;j <=i;j++)
{
System.out.print(j);
}
System.out.print();
}
}
}
Hope it helps you
Answered by
1
import java.util.Scanner;
public class program
{
public static void main(String args[])
{
System.out.println("1");
System.out.println("1 0");
System.out.println("1 0 1");
System.out.println("1 0 1 0");
System.out.println("1 0 1 0 1");
}
}
Similar questions