SlideShare una empresa de Scribd logo
1 de 3
UNIVERSIDAD NACIONAL DE CHIMBORAZO
FACULTAD DE CIENCIAS DE LA EDUCACION HUMANAS Y
TECNOLOGIAS
NOMBRE: GEOVANNY YUNGAN
PRACTICA 11
EJERCICIO 1
1.- se introduce atreves de teclado dos vectores A de n elementos y B de m elementos.
Fusionar los dos vectores en un tercer vector e imprimir. (si existe elementos repitos solo
debe mantenerse una sola vez el elemento)
//GEOVANNY YUNGAN //
package ASpractica11;
import java.util.Scanner;
class fufiona_n_elementos
{
public static void main(String arg [])
{
Scanner datos=new Scanner (System.in);
int [] a=new int [5000];
int [] b=new int [5000];
int n,m,y,j,i,x=0;
{
System.out.println("======FUSION DE DOS VECTORES===== n");
System.out.println("******INGRESE EL TAMAÑO DEL VECTOR A*****n");
n=datos.nextInt();;
for(i=0;i<n;i++)
{
System.out.println("=====INGRESE EL ELEMENTO=====n");
a[i]=datos.nextInt();
}
System.out.println("****INGRESE EL TAMAÑO DEL VECTOR B*** n");
m=datos.nextInt();;
for(j=0;j<m;j++)
{
System.out.println("=====INGRESE EL ELEMENTO=====n");
b[j]=datos.nextInt();
}
y=n+m;
i=0;
j=0;
int [] c=new int [y];
for (i = 0; i < n; i++)
{
c[i] = a[i];
}
for (i = n; i < y; i++)
{
c[i] = b[i-n];
}
for (i = 0; i < y - 1; i++)
{
for (j = i + 1; j < y; j++)
{
if (c[i] == c[j])
{
c[j] = -4000;
}
}
}
for (i = 0; i < y; i++)
{
if (c[i] != -4000)
{
x++;
}
}
int[] d = new int[x];
j = 0;
for (i = 0; i < y; i++)
{
if (c[i] != -4000)
{
d[j] = c[i];
j++;
}
}
System.out.println("n*****=====LA FUSION DE DOS VECTORES ES====******n");
for (i = 0; i < x; i++)
{
System.out.println(" n"+ d[i]);
}
System.out.println("n");
}
}
}
EJECUCION

Más contenido relacionado

La actualidad más candente (14)

Practica8
Practica8Practica8
Practica8
 
Practica 12
Practica 12Practica 12
Practica 12
 
Matriz Bidimensional
Matriz Bidimensional Matriz Bidimensional
Matriz Bidimensional
 
Informe jefferson cuenca_exposicion
Informe jefferson cuenca_exposicionInforme jefferson cuenca_exposicion
Informe jefferson cuenca_exposicion
 
Informe jefferson cuenca_exposicion
Informe jefferson cuenca_exposicionInforme jefferson cuenca_exposicion
Informe jefferson cuenca_exposicion
 
3
33
3
 
Practica3
Practica3Practica3
Practica3
 
Ejercicio 5
Ejercicio 5Ejercicio 5
Ejercicio 5
 
Ejercicio 5
Ejercicio 5Ejercicio 5
Ejercicio 5
 
10
1010
10
 
Practica 8
Practica 8Practica 8
Practica 8
 
Practica 8
Practica 8Practica 8
Practica 8
 
Sander moya
Sander moyaSander moya
Sander moya
 
Arreglo bidimensional ejercicio
Arreglo bidimensional ejercicioArreglo bidimensional ejercicio
Arreglo bidimensional ejercicio
 

Similar a Practica11 (20)

Practica9
Practica9Practica9
Practica9
 
Practica 9
Practica 9Practica 9
Practica 9
 
Practica 12
Practica 12Practica 12
Practica 12
 
Practica 9
Practica 9Practica 9
Practica 9
 
Practica 9
Practica 9Practica 9
Practica 9
 
Practica 9
Practica 9Practica 9
Practica 9
 
Practica10
Practica10Practica10
Practica10
 
Practica 8
Practica 8Practica 8
Practica 8
 
Practica 5
Practica 5Practica 5
Practica 5
 
Practica 10
Practica 10Practica 10
Practica 10
 
Practica 3
Practica 3Practica 3
Practica 3
 
8
88
8
 
Evaluacion2
Evaluacion2Evaluacion2
Evaluacion2
 
Practica 2
Practica 2Practica 2
Practica 2
 
Practica 3
Practica 3Practica 3
Practica 3
 
Practica 3
Practica 3Practica 3
Practica 3
 
Cecytem
CecytemCecytem
Cecytem
 
Ejercicio 5
Ejercicio 5Ejercicio 5
Ejercicio 5
 
Practica 2
Practica 2Practica 2
Practica 2
 
Practica 10
Practica 10Practica 10
Practica 10
 

Más de Geovanny Yungán (20)

Sibalo final
Sibalo finalSibalo final
Sibalo final
 
Sibalo
SibaloSibalo
Sibalo
 
Matemáticas
Matemáticas Matemáticas
Matemáticas
 
Artesanía de-la-ciudad-de-riobamba
Artesanía de-la-ciudad-de-riobamba Artesanía de-la-ciudad-de-riobamba
Artesanía de-la-ciudad-de-riobamba
 
Geovanny yungan (18)
Geovanny yungan (18)   Geovanny yungan (18)
Geovanny yungan (18)
 
Geovanny yungan (17)
Geovanny yungan (17) Geovanny yungan (17)
Geovanny yungan (17)
 
Geovanny yungan (16)
Geovanny yungan (16)  Geovanny yungan (16)
Geovanny yungan (16)
 
Geovanny yungan
Geovanny yungan Geovanny yungan
Geovanny yungan
 
Geovanny yungan redes
Geovanny yungan redesGeovanny yungan redes
Geovanny yungan redes
 
Geovanny yungan (14)
Geovanny yungan (14) Geovanny yungan (14)
Geovanny yungan (14)
 
Geovanny yungan (13)
Geovanny yungan (13) Geovanny yungan (13)
Geovanny yungan (13)
 
Geovanny yungan (12)
Geovanny yungan (12)Geovanny yungan (12)
Geovanny yungan (12)
 
Geovanny yungan (11)
Geovanny yungan (11)Geovanny yungan (11)
Geovanny yungan (11)
 
Geovanny yungan (10)
Geovanny yungan (10)   Geovanny yungan (10)
Geovanny yungan (10)
 
Geovanny yungan (9)
Geovanny yungan (9)Geovanny yungan (9)
Geovanny yungan (9)
 
Geovanny yungan (8)
Geovanny yungan (8)Geovanny yungan (8)
Geovanny yungan (8)
 
Geovanny yungan (7)
Geovanny yungan (7)  Geovanny yungan (7)
Geovanny yungan (7)
 
Geovanny yungan (6)n
Geovanny yungan (6)n  Geovanny yungan (6)n
Geovanny yungan (6)n
 
Geovanny yungan (5)
Geovanny yungan (5) Geovanny yungan (5)
Geovanny yungan (5)
 
Geovanny yungan (4)
Geovanny yungan (4)  Geovanny yungan (4)
Geovanny yungan (4)
 

Último

Calculadora de salud.pdfjsisiskejdjdjkjk
Calculadora de salud.pdfjsisiskejdjdjkjkCalculadora de salud.pdfjsisiskejdjdjkjk
Calculadora de salud.pdfjsisiskejdjdjkjk
emilianodominguez13
 
valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
Valentinaascanio1
 

Último (11)

tipos de suspension automotriz -rea marlon.pdf
tipos de suspension automotriz -rea marlon.pdftipos de suspension automotriz -rea marlon.pdf
tipos de suspension automotriz -rea marlon.pdf
 
Calculadora de salud.pdfjsisiskejdjdjkjk
Calculadora de salud.pdfjsisiskejdjdjkjkCalculadora de salud.pdfjsisiskejdjdjkjk
Calculadora de salud.pdfjsisiskejdjdjkjk
 
Mantenimientos básicos que debes dar a tu auto
Mantenimientos básicos que debes dar a tu autoMantenimientos básicos que debes dar a tu auto
Mantenimientos básicos que debes dar a tu auto
 
propoketapropoketapropoketapropoketa.pptx
propoketapropoketapropoketapropoketa.pptxpropoketapropoketapropoketapropoketa.pptx
propoketapropoketapropoketapropoketa.pptx
 
Capitulaciones-matrimoniales.pdddddddddddddptx
Capitulaciones-matrimoniales.pdddddddddddddptxCapitulaciones-matrimoniales.pdddddddddddddptx
Capitulaciones-matrimoniales.pdddddddddddddptx
 
unidades de medida aplicadas en gastronomia.pdf
unidades de medida aplicadas en gastronomia.pdfunidades de medida aplicadas en gastronomia.pdf
unidades de medida aplicadas en gastronomia.pdf
 
ELECTRICIDAD SISTEMA DE LUCES AUTOMOTRIZ.pptx
ELECTRICIDAD SISTEMA DE LUCES AUTOMOTRIZ.pptxELECTRICIDAD SISTEMA DE LUCES AUTOMOTRIZ.pptx
ELECTRICIDAD SISTEMA DE LUCES AUTOMOTRIZ.pptx
 
SENSORES POSICION MOTOR y su ubicacion en el motor
SENSORES POSICION MOTOR y su ubicacion en el motorSENSORES POSICION MOTOR y su ubicacion en el motor
SENSORES POSICION MOTOR y su ubicacion en el motor
 
valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
valentina ascanio jimenez bbbbbbbbbbbbbbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...
 
Manual de usuario de camioneta Mitsubishi L200.pdf
Manual de usuario de camioneta Mitsubishi L200.pdfManual de usuario de camioneta Mitsubishi L200.pdf
Manual de usuario de camioneta Mitsubishi L200.pdf
 
sistema-electrico-carroceria del motor de un vehículo.pdf
sistema-electrico-carroceria del motor de un vehículo.pdfsistema-electrico-carroceria del motor de un vehículo.pdf
sistema-electrico-carroceria del motor de un vehículo.pdf
 

Practica11

  • 1. UNIVERSIDAD NACIONAL DE CHIMBORAZO FACULTAD DE CIENCIAS DE LA EDUCACION HUMANAS Y TECNOLOGIAS NOMBRE: GEOVANNY YUNGAN PRACTICA 11 EJERCICIO 1 1.- se introduce atreves de teclado dos vectores A de n elementos y B de m elementos. Fusionar los dos vectores en un tercer vector e imprimir. (si existe elementos repitos solo debe mantenerse una sola vez el elemento) //GEOVANNY YUNGAN // package ASpractica11; import java.util.Scanner; class fufiona_n_elementos { public static void main(String arg []) { Scanner datos=new Scanner (System.in); int [] a=new int [5000]; int [] b=new int [5000]; int n,m,y,j,i,x=0; { System.out.println("======FUSION DE DOS VECTORES===== n"); System.out.println("******INGRESE EL TAMAÑO DEL VECTOR A*****n"); n=datos.nextInt();; for(i=0;i<n;i++) { System.out.println("=====INGRESE EL ELEMENTO=====n"); a[i]=datos.nextInt(); } System.out.println("****INGRESE EL TAMAÑO DEL VECTOR B*** n"); m=datos.nextInt();; for(j=0;j<m;j++) { System.out.println("=====INGRESE EL ELEMENTO=====n"); b[j]=datos.nextInt(); } y=n+m; i=0; j=0; int [] c=new int [y]; for (i = 0; i < n; i++) { c[i] = a[i]; }
  • 2. for (i = n; i < y; i++) { c[i] = b[i-n]; } for (i = 0; i < y - 1; i++) { for (j = i + 1; j < y; j++) { if (c[i] == c[j]) { c[j] = -4000; } } } for (i = 0; i < y; i++) { if (c[i] != -4000) { x++; } } int[] d = new int[x]; j = 0; for (i = 0; i < y; i++) { if (c[i] != -4000) { d[j] = c[i]; j++; } } System.out.println("n*****=====LA FUSION DE DOS VECTORES ES====******n"); for (i = 0; i < x; i++) { System.out.println(" n"+ d[i]); } System.out.println("n"); } } }