You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<Integer> arr = new ArrayList<>(); while(sc.hasNextInt()){ arr.add(sc.nextInt()); } int sum = arr.get(0); String ques = ""+arr.get(0); for(int i=1; i<arr.size(); i++){ int val = arr.get(i); ques+="+" + val; sum+=val; if(i!=3) System.out.println(ques+"="+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 →
import java.io.; import java.util.;
public class Solution {
}