-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlStructures.java
More file actions
37 lines (28 loc) · 1.2 KB
/
ControlStructures.java
File metadata and controls
37 lines (28 loc) · 1.2 KB
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: Control Structures */
/*CIS163AA 31892 */
/*Marc Holley */
/*4/10/2016 */
/*this program demonstrates control structures */
/************************************************************/
import java.util.Scanner;
// Class
public class ControlStructures {
// main method
public static void main(String[] args) {
// declaring and initalizing variable(s)
int numInput;
// constructing new scanner class
Scanner scnr = new Scanner(System.in);
// prompting user for input
System.out.println("Enter a even or odd number: ");
numInput = scnr.nextInt();
// conditional statement with logical operators
if (numInput % 2 == 0) {
System.out.println("Your number is even.");
}
// conditional statement with logical operators
else
System.out.println("Your number is odd.");
}
}