/
FirstHalf.java
45 lines (37 loc) · 1022 Bytes
/
FirstHalf.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
QUESTION:
1st Half / 2nd Half Alphabets
Leela is a science teacher for class V and she wants to divide the class into two halves
based on the starting letter of the names of the students.
Accept the first letter of name L of the students in the class and print 1st half, if the name of the student starts with A to M
Print 2nd half;, if the name of the student starts with N to Z.
Input Format
The first line contains a character L
Output Format:
Print 1st half or 2nd half for the input value L based on the conditions given.
Example Input/Output 1:
Input:
A
Output:
1st half
Example Input/Output 2:
Input:
x
Output:
2nd half
*/
import java.util.*;
public class Hello {
public static void main(String[] args) {
//Your Code Here
Scanner sc = new Scanner(System.in);
char a = sc.next().charAt(0);
if((a>=97 && a<=109) || (a>=65 && a<=77))
{
System.out.println("1st half");
}
else{
System.out.println("2nd half");
}
}
}