Txerrinko

Cantidades

Mar 18th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package Ejercicio2;
  2.  
  3. import java.io.IOException;
  4.  
  5. public class ej2 {
  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.      Integer[] cantidades=new Integer [100];
  15.        
  16.         int i,dato;
  17.        
  18.         System.out.println("Introduce numero:");
  19.         dato=Consola.leeInt();
  20.         for( i=0;i< cantidades.length && dato!=0;i++)
  21.         {
  22.             cantidades[i]=new Integer( dato );
  23.             System.out.println("Introduce numero:");
  24.             dato=Consola.leeInt(); 
  25.         }
  26.        
  27.         Integer[] inverso=new Integer [ i ];
  28.         int b = 0;
  29.        
  30.                 for ( int j = i-1 ; j >=0  ; j-- ){
  31.                inverso[b] = cantidades[j];
  32.                 b++;
  33.               }
  34.             for ( int j = 0 ; j < i ; j++ )
  35.             System.out.println( inverso[j]);
  36.    
  37.     }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment