Hi, i tried a lot of different combinations and cant solve the exercisse. Now it doesnt stop when i type -1.Maybe i have to declare a new int inside while loop? Im really lost..
package com.codegym.task.task04.task0442;


/*
Adding

*/

import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int a = Integer.parseInt(br.readLine());
        int sum = 0;

        while(a!=-1){
            sum+=a;
            if(a==-1){
                System.out.println(sum);
                break;
            }
        }
    }
}