Question: Hello can anybody tell me why this code is not working? I copied it from this link : http://www.chegg.com/homework-help/questions-and-answers/playing-game-roll-die-6-times-roll-5-6-four-times-win-4-dollars-two-three-times-win-2-doll-q20159331 a do la 2 C G

Hello

can anybody tell me why this code is not working? I copied it from this link : http://www.chegg.com/homework-help/questions-and-answers/playing-game-roll-die-6-times-roll-5-6-four-times-win-4-dollars-two-three-times-win-2-doll-q20159331

Hello can anybody tell me why this code is not working? I

a do la 2 C G Q Search Documentation Log In 1 MATLAB R2017a - academic use HOME PLOTS APPS L 4 SY 4 h Find Files 1 H New Variable R Analyze Code # Open Variable - Run and Time New New Open FB Compare Import Save Simulink Script - Data Workspace Clear Workspace Clear Commands - FILE VARIABLE CODE SIMULINK 1+ /> Users YoussefTanzakkine ? Documents ? MATLAB ? mynewdir Current Folder O Command Window E Name A >> function prize = DiceGame ( rolls) Layout O Preferences S Set Path illi Parallel - ENVIRONMENT Add-Ons Help 3 Community 9 Request Support 2 Learn MATLAB RESOURCES 3o winningRolls = 0; for i = 1 : length(rolls) if rolls(i) == 5 || rolls(i) == 6 winningRolls = winningRolls + 1; end Details end if winningRolls >= 4 Workspace Name A | winningRolls Value 0 prize = 4; elseif winningRolls > 1 prize = 2; else prize = 0; end function prize = DiceGame ( rolls) Error: Function definitions are not permitted in this context. fx >>|

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!