% Project Euler Problem 6
% https://projecteuler.net/problem=6

n = 100;

sumsquare = 0;
squaresum = 0;
for i=1:n
    sumsquare = sumsquare + (i*i);
    squaresum = squaresum + i;
end
squaresum = squaresum*squaresum;

fprintf('Difference equals %d\n', squaresum-sumsquare);
