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.
Day 3: Intro to Conditional Statements
Day 3: Intro to Conditional Statements
Sort by
recency
|
1790 Discussions
|
Please Login in order to post a comment
import java.util.Scanner; public class WeirdOrNot { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); if (N % 2 == 0) { if ((N >= 2 && N <= 5) || N > 20) { System.out.println("Not Weird"); } else if (N >= 6 && N <= 20) { System.out.println("Weird"); } } else { System.out.println("Weird"); } } }
import java.io.*;
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
}
Use an uppercase N