Java Day 3: Intro to Conditional Statements



In this challenge, we're getting started with conditional statements. Check out the Tutorial tab for learning materials and an instructional video!



  1. import java.io.*;
  2. import java.math.*;
  3. import java.security.*;
  4. import java.text.*;
  5. import java.util.*;
  6. import java.util.concurrent.*;
  7. import java.util.regex.*;
  8. public class Solution {
  9. public static void main(String[] args) {
  10. Scanner scan = new Scanner(System.in);
  11. int n = scan.nextInt();
  12. scan.close();
  13. if (n % 2 == 0) {
  14. if (n < 6) System.out.println("Not Weird");
  15. else if (n < 21) System.out.println("Weird");
  16. else System.out.println("Not Weird");
  17. } else System.out.println("Weird");
  18. }
  19. }