You are viewing a single comment's thread. Return to all comments →
Can someone help with the below logic.it is satisfing all the conditions but the test cases given after submission are failing -
int N = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
if((N%2==1)&&(N<100)||(N%2==0&&N>=6&&N<=20)){ System.out.println("weird"); } else if(N%2==0&&((N>=2&&N<=5)||(N>20&&N<100))){ System.out.println("Not weird"); } else{ System.out.println("N out of range"); } scanner.close();
Seems like cookies are disabled on this browser, please enable them to open this website
Java If-Else
You are viewing a single comment's thread. Return to all comments →
Can someone help with the below logic.it is satisfing all the conditions but the test cases given after submission are failing -
int N = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");