You are on page 1of 1

import java.util.

Scanner;
public class Invertir {
public static void main(String[] args) {
// TODO Auto-generated method stub
int x[]= new int [100];
int i,n;
Scanner leer= new Scanner(System.in);
System.out.println("ESTE PROGRAMA TE MOSTRARA EL VECTOR INVERTID
O QUE INGRESASTE");
System.out.println("INGRESE EL TAMAO DE EL VECTOR X");
n =leer.nextInt();
System.out.println("INGRESE LOS VALORES DE X \t");
for(i=0;i<n;i++){
System.out.print("VALOR X "+(i+1) +" :");
x[i]=leer.nextInt();
}///fin for para ingresar x
/////// FOR INPRIMIR VECTOR X
for(i=0;i<n;i++){
System.out.print(x[i]+" ");
}
System.out.print("EL VECTOR INVERTIDO ES ");
//////////// FOR PARA IMPRIMIR VECTOR X INVERTIDO
n--;
for(i=n;i>=0;i--){
System.out.print(x[i]+" ");
}
}
}

You might also like