Guest User

Untitled

a guest
Jun 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public class ejemplo4 {
  2.  
  3. final static byte[] n = { 4, 2, 5, 1, 6, 0, 6, 9, 5, 4, 5, 0 };
  4. static int numero_a_buscar = 1, i = 0;
  5. static boolean encontrado = false;
  6.  
  7. public static void main(String[] args) {
  8.  
  9. while(encontrado==false){
  10.  
  11. if(n[i]==numero_a_buscar){
  12. System.out.println("El número coincidio en la posición "+i+".");
  13. encontrado = true;
  14. }
  15. i++;
  16.  
  17. }
  18.  
  19. }
  20.  
  21. }
Add Comment
Please, Sign In to add comment