- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoddEven.java
More file actions
Latest commit
21 lines (18 loc) · 445 Bytes
/
Copy pathoddEven.java
File metadata and controls
21 lines (18 loc) · 445 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
packageBit_Manipulation;
importjava.util.Scanner;
publicclassoddEven {
publicstaticvoidmain(String[] args){
Scannersc=newScanner(System.in);
System.out.print("Enter a number to check: ");
intx=sc.nextInt();
if(checkOddEven(x)){
System.out.println(x+" is a Even Number. ");
}else{
System.out.println(x+" is a Odd Number. ");
}
sc.close();
}
staticbooleancheckOddEven(intnum){
return ((num & 1)==0);
}
}