Find Out if a Number is Positive or Negative
Determine whether a number is even or odd.
Example
int myNum = 10; // Is this a positive or negative number?
if (myNum > 0) {
System.out .println("The value is a positive number.");
} else if (myNum < 0) {
System.out .println("The value is a negative number.");
} else {
System.out .println("The value is 0.");
}
|