Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense para saber los atributos posibles.
// Mantenga el puntero para ver las descripciones de los existentes atributos.
// Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Sumatoria",
"request": "launch",
"mainClass": "Sumatoria",
"projectName": "Java-2023_e7000a08"
}
]
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[![Greetings](https://github.com/digitalers/Java-2023/actions/workflows/greetings.yml/badge.svg?branch=main)](https://github.com/digitalers/Java-2023/actions/workflows/greetings.yml)

# Java-2023

Repositorio del programa de formación gratuita en desarrollo de software y oficios digitales [Java Full Stack]
30 changes: 30 additions & 0 deletions Sumatoria.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
public class Sumatoria {
public static void main (String[] args) {
Integer numeros[] = {6,7,5,4,3,1,2,3,5,6,7,9,0,0,1,2,4,1,2,3,5,1,2};
suman(numeros);
}

public static void suman(Integer[] array) {

int sum = 0;
int i = 0;

while (i < array.length ) {
sum = array[i];

for (int f = i+1; f < array.length ; f++) {
sum += array[f];

if (sum == 13) {
System.out.printf("Loss elementos entre (%d, %d) suman 13\n", i , f);
break;
} else if (sum > 13) {
break;
}

}
i++;
}
}

}