import java.util.Scanner;

/**
 * Calculates the sum of the first k positive integers for a user-specified value of k. 
 *
 * @author Drue Coles
 */
public class Summer {

    public static void main(String[] args) {
        System.out.print("Enter a positive integer: ");
        int maxNum = new Scanner(System.in).nextInt();
        int sum = 0;
        int nextNumToAdd = 1;

        while (nextNumToAdd <= maxNum) {
            sum += nextNumToAdd;
            nextNumToAdd++;
        }

        System.out.printf("1 + 2 + 3 + ... + %,d = %,d %n", maxNum, sum);
    }
}