mirror of
https://bitbucket.org/Mattrixwv/octavefunctions.git
synced 2025-12-07 03:03:57 -05:00
Added a few comments to enhance understanding
This commit is contained in:
@@ -8,6 +8,7 @@ squares = nums.^2; %Square every number in the list nums
|
||||
sumOfSquares = sum(squares); %Get the sum of all the elements in the list squares
|
||||
squareOfSums = sum(nums)^2; %Get the sum of all the elements in the list nums and square the answer
|
||||
value = abs(squareOfSums - sumOfSquares); %Get the difference of the 2 numbers
|
||||
%This could all be done on one line, but this is less confusing
|
||||
|
||||
%Print the value
|
||||
value
|
||||
|
||||
Reference in New Issue
Block a user