int sum = 0; int j = 0; while (j <= 100) { sum += j; j++; } System.out.println(sum); sum = 0; for (int i = 1; i <= 100; i++) { sum += i; } System.out.println(sum);