Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java boolean even number

for (int i = 0; i < 5; i++) {
    System.out.println("Enter an integer.");
    x = in.nextInt();
    if (x % 2 == 0) {
        even++;
        System.out.println(x + " is even.");
    }
    if (x % 2  == 1) {
        odd++;
        System.out.println(x + " is odd.");
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #boolean #number
ADD COMMENT
Topic
Name
5+1 =