0
How do you sum the same numbers from two different groups of numbers in a java program?
For example: A: 2, 4, 6, 8, 10, 12, 14, 16, 18. B: 3, 6, 9, 12, 15, 18, 21. the same numbers: 6, 12, 18. sum: 6 + 12 + 18 = 36 I've tried this, but don't know what to do next. https://code.sololearn.com/cRrwX2NqpSqG/?ref=app Thanks in advance.
2 Réponses
+ 1
Thanks so much. It works! 😊
BTW, why isn't there any {} between "for" and "if" in your code?
Mine is:
for () {
if () {
statement
}
}
but yours is:
for ()
if () {
statement
}
They both work. Is there any reason?
0
Could you please show me how to write the code?
I don't get it. Sorry.