Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 15, 2021 20:27
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/db1267689f7619fa50e8a261f6db8351 to your computer and use it in GitHub Desktop.
Save parzibyte/db1267689f7619fa50e8a261f6db8351 to your computer and use it in GitHub Desktop.
/*
https://parzibyte.me/blog
*/
import java.util.Scanner;
public class Main{
public static boolean esPar(int numero) {
return (numero & 1) == 0;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Ingresa un número: ");
int numero = sc.nextInt();
if (esPar(numero)) {
System.out.println("Sí es par");
} else {
System.out.println("No es par");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment