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