int limit = 20, sum = 0, i = 1; while (i <= limit){ sum += i++; System.out.println(sum); }