Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ejercicio3;
- import java.util.*;
- public class Ejercicio3 {
- public static void main(String[] args) {
- Scanner sc= new Scanner (System.in);
- int [] v1;
- int [] v2;
- int [] vresul;
- int tam;
- System.out.println("Introduce tamaƱo de tus vectores: ");
- tam=sc.nextInt();
- v1=new int[tam];
- v2=new int[tam];
- vresul= new int[tam];
- for (int i = 0; i < tam; i++) {
- System.out.println("Introduce dato numero "+i+" para primer array");
- v1[i]=sc.nextInt();
- }
- for (int i = 0; i < tam; i++) {
- System.out.println("Introduce dato numero "+i+" para segundo array");
- v2[i]=sc.nextInt();
- }
- System.out.print("Su resultado es: ");
- for (int j = 0; j < tam; j++) {
- vresul[j]=v1[j]*v2[j];
- System.out.print(vresul[j]+" ");
- }
- }
- }
Add Comment
Please, Sign In to add comment