Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Ejercicio5;
- import java.io.IOException;
- public class Principal10Floats {
- /**
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- float[] posiciones = new float [10];
- float num;
- int i; //los indices en los arrays seran tipo int
- float previo=-20;
- for (i=0; i<posiciones.length;i++){
- System.out.println("Introduce numero");
- num=Consola.leeFloat();
- if (num<previo )
- {
- System.out.println("Numero menor al anterior");
- }
- else {
- posiciones[i]=num; //intercambio posiciones
- previo=num;
- }
- }
- //visualizara la posicion de cada array
- for (i=0; i<posiciones.length;i++){
- System.out.println("\r"+posiciones [i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment