Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/09/2014, 10:40
Japrendo
 
Fecha de Ingreso: noviembre-2013
Mensajes: 147
Antigüedad: 10 años, 5 meses
Puntos: 1
Respuesta: Programa java

Este es una clase viejita que habia trabajado hace un tiempo, suma los datos ingresados.

Código Java:
Ver original
  1. int Matriz[] = new int[3];
  2.         Scanner consola = new Scanner(System.in);
  3.         for (int x=0; x < Matriz.length; x++) {
  4.              System.out.println("Introduzca el elemento [" + x + ", ]");
  5.              Matriz[x] = consola.nextInt();
  6.         }
  7.         int tot=0;
  8.         for (int x=0; x < Matriz.length; x++) {
  9.             tot=tot+Matriz[x];
  10.         }                    
  11.         System.out.println ("total : " + tot );