We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- Introduction
- Java If-Else
- Discussions
Java If-Else
Java If-Else
Sort by
recency
|
1852 Discussions
|
Please Login in order to post a comment
if(n%2!=0){ System.out.println("Weird"); } else{ // If n is even if (n >= 2 && n <= 5) { System.out.println("Not Weird"); } else if (n >= 6 && n <= 20) { System.out.println("Weird"); } else if (n > 20) { System.out.println("Not Weird"); }
} scanner.close(); } }
This is my method.
Here is the Loop.
if (n % 2 == 1 || (n >= 6 && n <= 20)) { System.out.println("Weird"); } else { System.out.println("Not Weird"); }
import java.io.; import java.math.; import java.security.; import java.text.; import java.util.; import java.util.concurrent.; import java.util.regex.*;
public class Solution {
}
My Solution:
}
`