domingo, 27 de octubre de 2013

SUMA DE VECTORES

Entero vector [n];
entero r;
entero vector2 [n];
entero sumavector [n]

desde (r=1; r<=n; r+1)
       {
                sumavector [r]= vector[r]+vector[r]
           imprimir (sumavector[r])

           }


en java quedaría asi, los valores son genericos

int vector []=new int [3];
int vector2 []=new int [3];
vector [0] = 96;
vector [1] = 21;
vector [2] = 24;
vector2 [0] = 14;
vector2 [1] = 13;
vector2 [2] = 7;
int  r;
int sumavector [] = new int [3]

for (r=0;r<=3;r++)
{
    sumavector [r] = vector [r] + vector2 [r]
   system.out.println (sumavector[r]);


}








0 comentarios:

Publicar un comentario

deja un comentario