I`ve created this code to simulate winning the lottery if the person plays 100 times with same numbers. I want to add up the total winnings from the 100 times but not sure how to write the code.
%Player`s Numbers
PLayers_Numbers = input('Pick 6 different numbers from 1 to 59(Vector form):')for i = 1:1:100 %Winning Numbers
Winning_Numbers = datasample(1:59,6);%Number of correct numbers
Matching_Numbers = ismember(Winning_Numbers,PLayers_Numbers);Correct_Numbers = nnz(Matching_Numbers);%Calculation of Winnings
switch Correct_Numbers case{3} Winnings = 25 case{4} Winnings = 100 case{5} Winnings = 1000 case{6} Winnings = 1000000 otherwise Winnings = 0; end end
Best Answer