I have this list of 1
a 10
.
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Code:
List <Long> lista = new ArrayList();
for (long a = 1; a <= 10; a++) {
lista.add(a);
System.out.print(lista);
}
You would need a merged sum in this list, with a variable.
For example:
List <Long> lista = new ArrayList();
long x,z=200;
for (long a = 1; a <= 10; a++) {
x=z+a;
lista.add(x);
}
System.out.print(lista);
}
}
Instead of printing the normal list + 200
:
[201, 202, 203, 204, 205, 206, 207, 208, 209, 210]
I wanted the sum to be interleaved one yes another not ..
[1, 202, 3, 204, 5, 206, 7, 208, 9, 210]
And I also wanted to be able to change that distance from how many jumps to give the sum in the list could be from 2
to 2
or 5
to 5
... from 30
to 30
. .. understands .. depending on the size of the list ... list from 1
to 100
from 1
to 10000
...
Running on Repl: link