int[] numeros;
numeros = new int[3];
int con1 = 0, con2 = 0, num;
Scanner sc;
sc = new Scanner(System.in);
for (int i = 0; i < numeros.length; i++) {
System.out.println("Introduce 3 numeros:");
num = sc.nextInt();
numeros[i] = num;
}
System.out.println();
System.out.println("estos son tus numeros: ");
for (int i = 0; i < numeros.length; i++) {
System.out.print(numeros[i] + " ");
}
for (int i = 0; i < numeros.length; i++) {
for (int j = 0; j < numeros.length - i - 1; j++) {
con1++;
if (numeros[j] > numeros[j + 1]) {
con2++;
int aux;
aux = numeros[j];
numeros[j] = numeros[j + 1];
numeros[j + 1] = aux;
}
}
}
System.out.println();
System.out.println("ordenados: ");
for (int i = 0; i < numeros.length; i++) {
System.out.print(numeros[i] + " ");
}
Code Example |
---|
Java :: java-word-count |
Java :: permuatrion sequence |
Java :: android conditional api level |
Java :: {1 2 3 4 5 } |
Java :: serilize filke in java |
Java :: java assertions |
Java :: java optional input for funktions |
Java :: checkboslisttilw in flutter |
Java :: EuclideanAlgorithm in Java |
Java :: java loop aray |
Java :: trémaux’ method java |
Java :: luckperms api get usser by uuid |
Java :: fibonacci java |
Java :: detect view in scrollview android |
Java :: java isalphanum |
Java :: equality primitives java |
Java :: Java Numbers and Strings |
Java :: Java Multiple element Annotations |
Java :: kakao tech tcp close_wati |
Java :: system out java quick |
Java :: android studio remove navigation bar |
Java :: varargs java |
Java :: matrix rotation in java |
Java :: sorting algorithms in java |
Java :: Java Filters |
Java :: Spring boot init method |
Java :: java read all text from file |
Java :: print prime numbers in java |
Sql :: sql developer search all packages for text |
Sql :: dbms_scheduler drop_job |