Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*1. Escriba un programa que sume todos los elementos de un array de enteros. Utilícelo para sumar
- el vector: (1, 2, 3, 4, 5, 6).*/
- package ejer_1;
- public class Ejer_1 {
- public static void main(String[] args) {
- int [] numeros = {1,2,3,4,5,6};
- int suma = 0;
- for(int i=0;i<numeros.length;i++){
- suma = suma + numeros[i];
- }
- System.out.println("la suma es: " + suma);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement