Write an expression that will cause "greater or equal to -10" to print if the value of userNum is greater than or equal to -10.
import java.util.Scanner;
public class EqualityAndRelational {
public static void main (String [] args) {
int userNum;
Scanner scnr = new
Scanner(System.in);
userNum = scnr.nextInt(); // Program
will be tested with values: -9, -10, -11, -12.
if (//solution goes
here//) {
System.out.println("greater or equal to -10");
}
else {
System.out.println("less than -10");
}
}
}
import java.util.Scanner; public class EqualityAndRelational { public static void main (String [] args) { int userNum; Scanner scnr = new Scanner(System.in); userNum = scnr.nextInt(); // Program will be tested with values: -9, -10, -11, -12. if (userNum >= -10) { System.out.println("greater or equal to -10"); } else { System.out.println("less than -10"); } } }
Get Answers For Free
Most questions answered within 1 hours.