function percentage = coinTosses(run_time, n)
% coinTosses should execute run_time flips of n coins, and return
% the percentage of time that the proportion of heads is between 0.4 & 0.6.
% Note: the answer you put in online at Project Probability should be 
% the smallest n such that coinTosses(2000,n) consistently returns at least
% 95. (Reminder: percentage should be a number from 0 to 100.)


k = 0; % initalize counter

for j = 1:run_time

    flips = zeros(1,n);
	% initialize the vector "flips" -- it starts off as a bunch of 0's


	for i=1:n
	    flips(i) = randi(2)-1;
	    % at each cell of the vector, generator a random integer between 1 and
	    % 2 and subtract 1 from it (so we have a random integer between 0 and
	    % 1
    end
    

    proportion = sum(flips)/n;
    
    if proportion<=.6 && proportion>=.4
        k = k+1; % counts how many satisfy this condition
    end
end


percentage = 100*k/run_time; % percentage, so multiply proportion by 100.



%%% All of your code should go above this line.             %%%
end