sum squares of numbers from 5 to 70 in matlab

You can use a for loop and arithmetic operations to sum the squares of numbers from 5 to 70 in MATLAB:

main.m
sum_squares = 0; % initialize the sum
for i = 5:70 % loop through numbers from 5 to 70
    sum_squares = sum_squares + i^2; % add the square of the current number to the sum
end
178 chars
5 lines

The variable sum_squares will contain the result of the sum of squares of numbers from 5 to 70.

gistlibby LogSnag