/ Published in: MatLab
- % Alexander DeTrano
- % Project Euler - Problem 6
- % Find the difference between % the sum of the squares of the first one
- % hundred natural numbers and the square of the sum.
- first100 = [1:100]; %Generate first 100 numbers
- sum_squares = sum(first100.^2); %square each element and sum
- squares_sum = sum(first100)^2; %sum each element and square
- diff = squares_sum-sum_squares
You need to login to post a comment.