
Acumulados
Publicado por Alejandro hernandez (1 intervención) el 24/08/2017 02:33:19
Saludos, tengo este ejercicios e hice este codigo.
podrían decirme por favor qué error tengo y como podría solucionarlo? muchas gracias.

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
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner o=new Scanner(System.in);
int x;
x=o.nextInt();
int b[]=new int[x];
for (int i=0; i<x;i++)
{b[i]=o.nextInt();}
int acum = 0;
int j;
j= x;
while (j!=0)
{
j = j - 1;
acum = acum + b[j];
if (acum != b[j])
{
System.out.println(acum);
}
}
}}
podrían decirme por favor qué error tengo y como podría solucionarlo? muchas gracias.

Valora esta pregunta


0