Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.forge;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Scanner;
- 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 < 10; i++) {
- System.out.println("ingrese un numero");
- int n = in.nextInt();
- numeros.add(n);
- }
- while (!numeros.isEmpty()) {
- int max = 0;
- System.out.println(numeros);
- for (int x : numeros) {
- if (x > max) max = x;
- }
- int pmax = numeros.indexOf(max);
- numeros.remove(pmax);
- }
- System.out.println(numeros);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement