Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package vector_orden;
- import java.util.Scanner;
- public class Vector_orden {
- public Scanner key;
- private int[] sueldos;
- public void cargar() {
- key = new Scanner(System.in);
- sueldos = new int[5];
- for (int f=0;f<5;f++) {
- System.out.print("Ingrese un numero: ");
- sueldos[f]=key.nextInt();
- }
- }
- public void orden() {
- int aux;
- for (int k=0;k<sueldos.length-1;k++) {
- for (int f=0;f<sueldos.length-1;f++) {
- if (sueldos[f]>sueldos[f+1]) {
- aux=sueldos[f];
- sueldos[f]=sueldos[f+1];
- sueldos[f+1]=aux;
- }
- }
- }
- for (int m=0;m<5;m++) {
- System.out.println(sueldos[m]);
- }
- }
- public static void main(String[] args) {
- Vector_orden load=new Vector_orden();
- load.cargar();
- load.orden();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment