Skip to content

Instantly share code, notes, and snippets.

@viveknarang
Created February 7, 2018 02:09
Show Gist options
  • Save viveknarang/b218111822523fc73fa2adda86248fad to your computer and use it in GitHub Desktop.
Save viveknarang/b218111822523fc73fa2adda86248fad to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class NegativeOrPositive {
public static void main (String [] args) {
String condStr;
int userVal;
userVal = -9;
condStr = (userVal >= 0)?"non-negative":"negative";
System.out.println(userVal + " is " + condStr);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment