Scanner sqr = new Scanner(System.in); int a ; int b = 0; do{ a = sqr.nextInt(); a+=b; System.out.println(a); } while(a != -1);