
suma de vectores de n dimension
Publicado por Jaqueline (1 intervención) el 26/05/2018 19:56:08
Hola este es mi codigo nose como corregir el error que me marca se que es porque estoy accediendo a una parte de la memoria del arreglo que no existe pero lo que quiero es hacer la logica para leer un vector de n componetnes
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
/**
*
* @author SYSTEM
*/
public class Pruebitas {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int dimension =2;
int l;
int st=0,s1;
int u= dimension;
// int[] wb= new int[u];
int[][] bp= new int[u][u];
bp[0][0]= 2;
bp[0][1]=1;
bp[1][0]=1;
bp[1][1]=2;
// public int[]norma(int[] bp,int dimension ){
int c;
int t=0;
int[] wb= new int[dimension];
for (c=0;c<dimension+1;c++){
for (int j=0; j<dimension+1;j++){
t =(bp[c][j]*bp[c][j])+t;
wb[c]=t;
System.out.println(wb[c]);
}
}
}
Valora esta pregunta


0