even or odd in java
import java.util.Scanner;
public class evenOrOdd{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("Please enter a non-negative number: ");
int x = in.nextInt();
if (x % 2 == 0)
{
System.out.println("The number is even");
}
else {
System.out.println("The number is odd");
}
}
}
Also in Java:
- how to remove spaces from an array in java
- raspberry stackexchange how to install the java jdk
- creating thread in java example
- even or odd in java
- start thread java
- nextchar in java
- close scanner java
- java lerp
- sqrt in java
- how to add an image to a gui in java windowbuilder
- money value commas java
- reverse string using recursion java with explanation
- java obtain list string from list object
- java int passed by reference
- java get current date without time
- java how to print a string[]
- how to install java runtime environment on centos 7
- how to make a variable unchangeable in java
- query java persistence
- write in file java
- how to remove a certain string in a arraylist java
- java letter alphabet index
- if en une seul ligne java
- java list all non directory files in the directory