Displays each of the numbers input instead of their sum. What am I missing. Ugh seemed like I had it too at first.
package com.codegym.task.task04.task0442;
/*
Adding
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while(true)
{int sum = 0;
String str = reader.readLine();
int a = Integer.parseInt(str);
sum = (sum + a);
System.out.println(sum + a);
if(a == -1){
break;
}else{
}
//System.out.println(sum);
}
}
}