Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created November 6, 2013 04:48
Show Gist options
  • Save pepet96/7331071 to your computer and use it in GitHub Desktop.
Save pepet96/7331071 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
import java.io.*;
class PosNeg {
public static void main (String [] args) throws IOException {
Scanner input = new Scanner(System.in);
double number;
System.out.println("This program will determine if the value entered is positive or negative. \nPlease enter a value for the program to read: ");
number = input.nextDouble();
if (number > 0)
System.out.println("The number is positive");
else if (number == 0 )
System.out.println("Why would you enter a value that is neither positive nor negative?");
else if (number < 0)
System.out.println("The number is negative");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment