Added code to cleanup the variables at the end of the script

This commit is contained in:
2018-09-26 11:17:37 -04:00
parent b63ca10669
commit 2468bd4f80
5 changed files with 24 additions and 15 deletions

View File

@@ -6,7 +6,6 @@
fib = [1, 1, 2]; %Holds the Fibonacci numbers
currentFib = fib(end) + fib(end - 1); %The current Fibonacci number to be tested
evenFib = [2]; %A subset of the even Fibonacci numbers
finalSum = 0;
while(currentFib < 4000000)
%Add the number to the list
@@ -20,5 +19,9 @@ while(currentFib < 4000000)
currentFib = fib(end) + fib(end - 1);
end
finalSum = sum(evenFib);
finalSum
sum(evenFib)
%Cleanup your variables
clear fib;
clear currentFib;
clear evenFib;