I am getting an output of 0000 and I am not sure what I am doing wrong.
while (true) {
int n=Integer.parseInt(cbeu.readLine());
if (n==-1) {
sum+=n;
break;
}
System.out.print(sum);
package com.codegym.task.task04.task0442;
/*
Adding
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader cbeu=new BufferedReader(new InputStreamReader(System.in));
//write your code here
int sum=0;
while (true) {
int n=Integer.parseInt(cbeu.readLine());
if (n==-1) {
sum+=n;
break;
}
System.out.print(sum);
}
}
}