Java program to display triangle 0 10 101 0101

1
2
3
4
5
6
7
8
9
10
11
1
/* Display Triangle as follow
   0
   1 0
   1 0 1
   0 1 0 1 */
class Output2{
	public static void main(String args[]){
		for(int i=1;i<=4;i++){
			for(int j=1;j<=i;j++){
				System.out.print(((i+j)%2)+" ");
			}
			System.out.print("\n");
		}
	}

Comments

Popular posts from this blog

Java program to display triangle 1 23 456 78910

Google Invests Heavily In Canada For AI Lab