diloentutospc

NUMERO PAR O IMPAR

Oct 8th, 2018
8,862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ParImpar {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.         Scanner teclado = new Scanner(System.in);
  8.        
  9.         int n;
  10.        
  11.         System.out.print("Por favor ingrese el número a evaluar: ");
  12.         n = teclado.nextInt();
  13.        
  14.         if(n % 2 == 0) {
  15.             System.out.println(n+" es un número par.");
  16.         }else {
  17.             System.out.println(n+" no es un número par.");
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment