Ola
Preciso da ajuda de vcs
O programa tem 3 vetores A B e C e cada um deles tem 5 numeros
Preciso que o vetor D tenho todos eles.
Aonde estou errando?
import javax.swing.JOptionPane;
class Exercicio5 {
public static void main(String arg[]) {
int A[] = new int[5];
int B[] = new int[5];
int C[] = new int[5];
int D[] = new int [15];
for (int i = 0; i < 5; i++) {
String a = JOptionPane.showInputDialog(null, "Digite o valor A ["+ i + "]");
A[i] = Integer.parseInt(a);
}
for (int i = 0; i < 5; i++) {
String b = JOptionPane.showInputDialog(null, "Digite o valor B ["+ i + "]");
B[i] = Integer.parseInt(b);
}
for (int i = 0; i < 5; i++) {
String c = JOptionPane.showInputDialog(null, "Digite o valor C ["+ i + "]");
C[i] = Integer.parseInt(c);
}
for (int i = 0; i < 5; i++) {
D[i * 2] = A[i];
D[i * 2 + 1] = B[i];
D[i * 2 + 2] = C [i];
}
String saida ="";
for (int i = 0; i < 15; i++) {
saida += "D[" +i+ "] =" + D[i] + "\n";
}
JOptionPane.showMessageDialog(null,saida);
}
}