Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started