-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExer01.java
More file actions
48 lines (28 loc) · 866 Bytes
/
Exer01.java
File metadata and controls
48 lines (28 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.laiane.cursojava.aula19;
import java.util.Scanner;
public class Exer01 {
public static void main(String[] args) {
try (var scan = new Scanner(System.in)) {
int[] vetorA = new int[5];
int[] vetorB = new int[vetorA.length];
/*ENTRAR COM AS INFORMAÇÕES COM O "For"*/
for (int i=0; i<vetorA.length; i++){
System.out.println("Entre com o valor da posição: " + i);
vetorA[i] = scan.nextInt();
}
for (int i=0; i<vetorA.length; i++){
vetorB[i] = vetorA[i];
}
System.out.println("Vetor A = ");
for (int i=0; i<vetorA.length; i++){
System.out.println(vetorA[i] + "");
}
System.out.println();
System.out.println("Vetor B = ");
for (int i=0; i<vetorB.length; i++){
System.out.println(vetorB[i] + " ");
}
System.out.println();
}
}
}