clearclccount_eight=0;clearclccount_eight=0;RandStream.setDefaultStream = (RandStream('mt19937ar','seed',sum(100*clock)));roll=input('Enter number of rolls \n');for rolling = 1:roll dice1 = randi(6); dice2 = randi(6);endif dice1+dice2==8 count_eight=count_eight+1; endfprintf('Percentage of times an 8 appeared %.1f ',count_eight(roll*100));display('End of Program')roll=input('Enter number of rolls \n');for rolling = 1:roll dice1 = randi(6); dice2 = randi(6);endif dice1+dice2==8 count_eight=count_eight+1; endfprintf('Percentage of times an 8 appeared %.1f ',count_eight(roll*100));display('End of Program')
ERROR MESSAGE:
??? Index exceeds matrix dimensions.Error in ==> Homework10 at 51fprintf('Percentage of times an 8 appeared%.1f ',count_eight(roll*100));
Best Answer