forked from sathishmepco/Java-Interview-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvenOrOdd.java
More file actions
36 lines (33 loc) · 698 Bytes
/
EvenOrOdd.java
File metadata and controls
36 lines (33 loc) · 698 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
31
32
33
34
35
36
package com.java.basic;
import java.util.Scanner;
/*
* EVEN OR ODD
* ------------
* Divide the given number by 2
* If the reminder is 0 then its EVEN
* If the reminder is 1 then its ODD
*
* 22 EVEN number
* 23 ODD number
*
*/
public class EvenOrOdd {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the any number : ");
int num = scanner.nextInt();
if( num % 2 == 0)
System.out.println("Given number is EVEN");
else
System.out.println("Given number is ODD");
scanner.close();
}
}
/*
OUTPUT
Enter the any number : 22
Given number is EVEN
OUTPUT
Enter the any number : 25
Given number is ODD
*/