1.

Print the pattern in Java.101010010101010010100please quickly answer​

Answer»

Answer:enter the numbers of rows on your own

Explanation:

Hey you how can I write the whole program

Here.

import java.util.SCANNER

class Binarypattern4{

public static VOID main(String args[]){

int i,j,rows;

int count=1;

Scanner scan=new Scanner(System.in);

System.out.print("Enter the NUMBER of rows: ");

rows=scan.nextInt();

for(i=1; i<=rows; i++){

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

if(j%2==1){

System.out.print("1");

}

else{

System.out.print("0");

}

}

System.out.println();

}

}

}



Discussion

No Comment Found