Skip to content

Commit 77f185a

Browse files
committed
Solution for EvenODD Number Program
1 parent 95b6284 commit 77f185a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎src/Assignments/EvenOrOdd.java‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
//import com.sun.source.tree.AssignmentTree;
44

5+
import java.util.Scanner;
6+
57
public class EvenOrOdd {
68
public static void main(String[] args) {
79
EvenOrOdd obj = new EvenOrOdd();
@@ -11,7 +13,16 @@ public static void main(String[] args) {
1113
}
1214

1315
void isOddOrEven(){
14-
System.out.println("ODD");
16+
17+
Scanner input = new Scanner(System.in);
18+
System.out.println("Please enter the number: ");
19+
int inputNumber = input.nextInt();
20+
21+
if (inputNumber % 2 == 0){
22+
System.out.println("This is an Even Number");
23+
}else {
24+
System.out.println("This is an ODD Number");
25+
}
1526
}
1627

1728
void isPalindrome(){

0 commit comments

Comments
 (0)