import java.util.ArrayList;
import java.util.Scanner;
 class Main{
  public static void main(String[] args){
  Scanner teclado = new Scanner(System.in);
  
  ArrayList<Integer> arreglo = new ArrayList<Integer>();
  int n, dato;
  n = teclado.nextInt();
  for(int i=0; i<n; i++){
      arreglo.add(teclado.nextInt());
  }
  dato =  teclado.nextInt();
  
  for(int i=0; i< arreglo.size(); i++){
    if(arreglo.get(i) == dato ){
        arreglo.remove(i);
    }
   }
   if (n != arreglo.size()){
    for(int i=0; i< arreglo.size()- 1; i++){
        System.out.print(arreglo.get(i)+ " ");
    }
    System.out.print(arreglo.get(arreglo.size() - 1));
   }
   else 
       System.out.print("El numero no esta!");
  }
}

/* datos de entrada
5  
4 5 8  6 5
5

segundo ejemplo de dato de entrada
3
4 8 13
8

tercer ejemplo de dato de entrada

4
2 5 7 9
8
*/

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: