+ 1
How to sum up any two numbers entered by the user through a space? (Java)
The user enters any two numbers through and needs to sum them up. (Java)
1 Resposta
+ 2
There are many ways to do this, Arrays or ArrayLists of type string or integer from the inputs using "scanner". From there just use a "for loop" to get the first index value and the one next to it, and sum them into a variable, and then move to the next index and sum it again until you meet the "length" of the array or the "size()" of the ArrayList.
Something like this:
for (int i = 0; i < array.length; i++){
variable += array[i];
}
Just clean the inputs so that that every value get into aN index as expected.