mirror of
https://bitbucket.org/Mattrixwv/octavefunctions.git
synced 2025-12-06 18:53:57 -05:00
Added code to cleanup the variables at the end of the script
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
%What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
|
||||
|
||||
%Create your variables
|
||||
value = 0; %The value that is evenly divisible
|
||||
nums = [1:20];
|
||||
factors = [1]; %The factors that are already in the number
|
||||
list = []; %For a temperary list of the factors of the current number
|
||||
@@ -33,13 +32,12 @@ while(counter <= size(nums)(2))
|
||||
++counter;
|
||||
end
|
||||
|
||||
prod(factors)
|
||||
|
||||
%Cleanup your variables
|
||||
clear counter;
|
||||
clear factorCnt;
|
||||
clear listCnt;
|
||||
clear list;
|
||||
clear nums;
|
||||
clear ans; %Appears whenever you use increment
|
||||
|
||||
value = prod(factors);
|
||||
value
|
||||
clear factors;
|
||||
|
||||
Reference in New Issue
Block a user