Leer un número y determinar si es negativo en Java.
import java.io.*; public class negativo { public static void main(String [] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); System.out.print("Introduce un numero: "); int num = Integer.parseInt(br.readLine()); if(num < 0) { System.out.println("Es negativo"); } } }
Recognizing whether a number is negative on Java
0 comentarios ↓
Nadie se ha animado a comentar... Se el primero!!
Leave a Comment