Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created March 23, 2019 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/131a62a3ddafc4f18b50f88bf4155428 to your computer and use it in GitHub Desktop.
Save parzibyte/131a62a3ddafc4f18b50f88bf4155428 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner escaner = new Scanner(System.in);
// Mandar mensaje
System.out.println("Escribe un número:");
// Leer lo que se introduce
double numero = escaner.nextDouble();
// Comparar
if (numero == 0) {
System.out.println("El número es neutro");
} else if (numero < 0) {
System.out.println("El número es negativo");
} else {
System.out.println("El número es positivo");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment