Last active
August 7, 2019 15:31
-
-
Save parzibyte/e24fd98db3ddd9e2653ffba94975d09a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
// Demostración con enteros | |
int[] numeros = { 50, 21, 6, 97, 18 }; | |
int numeroBuscado = 20; | |
int posicionDeElementoBuscado = existeEnArreglo(numeros, numeroBuscado); | |
if (posicionDeElementoBuscado == -1) { | |
System.out.println("El elemento NO existe en el arreglo"); | |
} else { | |
System.out.println("El elemento existe en la posición: " + posicionDeElementoBuscado); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment