Skip to content

Commit 7b894f8

Browse files
committed
Condition Exercise
1 parent 373532c commit 7b894f8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

ch05/Condition.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
public class Condition
2+
{
3+
public static void main(String[] args)
4+
{
5+
int num1 = 1357;
6+
int num2 = 2468;
7+
String result;
8+
9+
result = (num1 % 2 != 0) ? "Odd" : "Even";
10+
System.out.println(num1 + " is " + result);
11+
12+
result = (num2 % 2 != 0) ? "Odd" : "Even";
13+
System.out.println(num2 + " is " + result);
14+
}
15+
}

0 commit comments

Comments
 (0)