import java.util.Scanner; public class Program3{ public static void main(String[] args){ int n, sum_of_squares=0, sum=0, square_of_sum; Scanner scan = new Scanner(System.in); System.out.print("Enter a positive integer: "); n = scan.nextInt(); for (int i=1; i<=n; i++){ sum += i; sum_of_squares += i*i; } square_of_sum = sum*sum; System.out.println("The square of the sum of the first " + n + " positive integers is " + square_of_sum + "."); System.out.println("The sum of the squares of the first "+n+ " positive integers is " + sum_of_squares + "."); System.out.println("Their difference is " + (square_of_sum - sum_of_squares) + "."); } }