Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

import java.io.

*;
import java.util.Scanner;
public class eje_2 {

public static void llenar_vector(int v[], int n)


{
Scanner leer=new Scanner (System.in);
int i;
for (i=0;i<n;i++) {
System.out.print("v["+i+"]= ");
v[i]=leer.nextInt();
}
}

public static void mostrar_vector(int v[],int n)


{

int i;

for ( i=0;i<n;i++) {
System.out.print("["+v[i]+"]");
}

public static void main(String[] args)

int n;
int v[]=new int[20];
Scanner leer=new Scanner(System.in);
n=leer.nextInt();

llenar_vector(v,n);
mostrar_vector(v,n);

You might also like