You are viewing a single comment's thread. Return to all comments →
Hi, How to optimize this code,
if(N>1 && N<=100){
int test = N%2; if(test==0) { if(N==2 || N==4) System.out.println("Not Weird"); else if(N>=6 && N<=20) System.out.println("Weird"); else if(N>20)System.out.println("Not Weird"); } else System.out.println("Weird"); } else System.out.println("Invalid Number");
I've passed all test case but I like to optimize this above code, anyone have idea please tell, Thanks
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 →
Hi, How to optimize this code,
if(N>1 && N<=100){
I've passed all test case but I like to optimize this above code, anyone have idea please tell, Thanks