You are viewing a single comment's thread. Return to all comments →
class Add { void add(int... values){ int sum = 0; for (int value : values) { sum += value; System.out.print(value); if(value == values[values.length-1]) { System.out.print("=" +sum); break; } System.out.print("+"); } System.out.println(); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Varargs - Simple Addition
You are viewing a single comment's thread. Return to all comments →