Skip to content

Commit b81484f

Browse files
committed
IF Else usage in Java
1 parent 8ae1a08 commit b81484f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

IfElse.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import java.io.*;
2+
import java.util.*;
3+
import java.text.*;
4+
import java.math.*;
5+
import java.util.regex.*;
6+
7+
public class Solution {
8+
9+
public static void main(String[] args) {
10+
11+
Scanner sc=new Scanner(System.in);
12+
int n=sc.nextInt();
13+
String ans="";
14+
if(n%2==1){
15+
ans = "Weird";
16+
}
17+
else{
18+
if(n>=2 && n<=5){
19+
ans = "Not Weird";
20+
}
21+
if(n>=6 && n<=20)
22+
{
23+
ans = "Weird";
24+
}
25+
else if(n>=20){
26+
ans = "Not Weird";
27+
28+
}
29+
30+
}
31+
32+
33+
//Complete the code
34+
35+
36+
System.out.println(ans);
37+
38+
}
39+
}

0 commit comments

Comments
 (0)