Question: Matlab Question 2: Divide two numbers that are entered by the user. Ask user to input 2 numbers a and b and find a/b. Repeat
Question 2: Divide two numbers that are entered by the user. Ask user to input 2 numbers a and b and find a/b. Repeat the division 3 times total. If the user enters b=0, display 'Denominator cannot be O' and skip to the next division. (15 points) Example: 1st number: 1 2nd number: 4 ratio = 0.2500 1st number: 5 2nd number: 0 Denominator cannot be 0 1st number: -3 2nd number: 7 ratio = -0.4286 Question 3: Sum the digits of a given number. Ask user to input a number and find the summation of the digits. Example: input: 1453 output: 13 (since 1+4+5+3=13) Hint: You can use numel(num 2str(number)) to get the number of digits in a number. Other commands that may be used in your solution: mod, floor. (15 points) Question 4: Display 5 coin flip outputs by using rand function. rand gives random values between (0,1). You need to have output either -1 (head) or 1 (tails). Hint: rand
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
