Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.forge;
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- // write your code here
- Scanner in = new Scanner(System.in);
- List<Integer> numeros = new ArrayList<>();
- for (int i = 0; i < 5; i++) {
- System.out.println("ingrese un numero");
- int n = in.nextInt();
- numeros.add(n);
- }
- Set<Integer> noRepetidos = new HashSet<>();
- noRepetidos.addAll(numeros);
- System.out.println(numeros);
- System.out.println(noRepetidos);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement