public class Sum2 { public static void main(String[] args) { int n = 100; int sum = 0; for (int i = 1; i <= n; i = i + 1) { sum += i; } System.out.println("The sum of the numbers from 1 to " + n + " is " + sum + "."); } }