Txerrinko

Borrado

Mar 18th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. package Ejercicio8;
  2.  
  3. import java.io.IOException;
  4.  
  5. public class Borrado {
  6.  
  7.     /**
  8.      * @param args
  9.      * @throws IOException
  10.      */
  11.     public static void main(String[] args) throws IOException {
  12.         // TODO Auto-generated method stub
  13.        
  14.        
  15.         int n,pos;
  16.         int [] caracteres={2,4,5,7,12,6,34,11};
  17.        
  18.         System.out.println("Indique la posicion a eliminar");
  19.         n=Consola.leeInt();
  20.        
  21.         int b=caracteres.length;  
  22.         pos= caracteres[n-1];
  23.         for (int i=n-1;i<b;i++){
  24.             caracteres[i]=caracteres[i+1];
  25.             b--;
  26.            System.out.println(caracteres[i]);
  27.         }
  28.        
  29.            
  30.        
  31.        
  32.        
  33.        
  34.     }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment