Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Ejercicio2;
- import java.io.IOException;
- public class ej2 {
- /**
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- Integer[] cantidades=new Integer [100];
- int i,dato;
- System.out.println("Introduce numero:");
- dato=Consola.leeInt();
- for( i=0;i< cantidades.length && dato!=0;i++)
- {
- cantidades[i]=new Integer( dato );
- System.out.println("Introduce numero:");
- dato=Consola.leeInt();
- }
- Integer[] inverso=new Integer [ i ];
- int b = 0;
- for ( int j = i-1 ; j >=0 ; j-- ){
- inverso[b] = cantidades[j];
- b++;
- }
- for ( int j = 0 ; j < i ; j++ )
- System.out.println( inverso[j]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment