-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path40_Control2.java
More file actions
37 lines (35 loc) · 793 Bytes
/
40_Control2.java
File metadata and controls
37 lines (35 loc) · 793 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
37
/*
* Program for simple if-else statement
*/
package javaprograms;
import java.util.*;
/**
*
* @author Geeky Keshav
*/
public class Control2
{
public static void main(String [] args)throws Exception
{
Scanner obj=new Scanner(System.in);
System.out.print("Enter a number: ");
int a=obj.nextInt();
if(a%2==0)
{
System.out.println("Given number is Even.");
}
else
{
System.out.println("Given number is odd.");
}
}
}
/******OUTPUT****
* If the statement is true:
Enter a number: 30 //given data
Given number is Even.
*
* *If the Condition is false:
Enter a number: 15 //given data
Given number is odd.
*/