We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c814db2 commit a50d581Copy full SHA for a50d581
Basic-Java/EvenOdd.java
@@ -0,0 +1,24 @@
1
+import java.util.Scanner;
2
+
3
+public class EvenOdd {
4
5
+ public static void main(String[] args) {
6
7
+ int num,flag;
8
+ System.out.println("Program to check if the number is even or odd!\n---");
9
+ System.out.println("Enter the number: ");
10
+ Scanner scanner = new Scanner(System.in);
11
+ num = scanner.nextInt();
12
+ scanner.close();
13
14
+ flag = num % 2;
15
+ if(flag == 0) {
16
+ System.out.println("The number you entered is even.");
17
+ }
18
+ else {
19
+ System.out.println("The number you entered is odd.");
20
21
22
23
24
+}
0 commit comments