- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif_else__Even_Odd.java
More file actions
Latest commit
30 lines (25 loc) · 769 Bytes
/
Copy pathif_else__Even_Odd.java
File metadata and controls
30 lines (25 loc) · 769 Bytes
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
// Question Check Input Number is Even Odd
// Take the Input from User
// Number
// print Even or Odd
importjava.util.Scanner;
publicclassif_else__Even_Odd{
// Defing a Class
publicstaticvoidmain(Stringargs[]){
// Main Class
Scannerobj=newScanner(System.in);
// Creating Object Scanner
intNumber;
// Create Intger Variable
System.out.println("\n\nEnter The Number to Check Even or Odd");
Number=obj.nextInt();
// Taking User Input
// Logic : Check is divisble by 2 and Equal to 0 - If its True , then its Number is Even
if(Number%2==0)
System.out.println("Number Is Even");
// Printing Number is Even
else
// Printing Number is ODD
System.out.println("Number Is Odd");
}
}