Explain the test case in whic i failed
Mamohan loves pattern
@guptakanwal30 you have to take user input for N and then print the pattern according to the value of N. Right now you are only printing for n = 6 and not taking any input
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int str=1;
int csp=0;
if (n<=1000) {
System.out.println("1");
for(int row=1;row<=n-1;row++) {
for(int st=1;st<=str;st++){System.out.print("1");}
for(int sp=1;sp<=csp;sp++){
if (row%2==0)
System.out.print("1");
else System.out.print("0");
}
for(int st=1;st<=str;st++){System.out.print("1");}
System.out.println("");
csp=csp+1;
}}
else {
System.out.print("INVALID");
}
}}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.