You are viewing a single comment's thread. Return to all comments →
class Add{
void add(int... a){ int sum=0; for(int i=0;i<a.length;i++){ sum=sum+a[i]; System.out.print(a[i]); if(i<(a.length-1)){ System.out.print("+"); } } System.out.println("="+sum); }
}
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 →
class Add{
}