Question: Code has already been provided to define a function named divideBySeven that accepts a single input variable number that is any positive number. Add


Code has already been provided to define a function named divideBySeven that accepts a single input variable number that is any positive number. Add commands to use a while loop to repeatedly divide this number by 7 until the value remaining is less than 1. Your function should assign values to the two output variables as follows: Assign the final value of the number to the output variable whats Left. Count the number of divisions required and assign the result to the output variable divisionCount. As an example, if the input number is 15, the function should return 2 for divisionCount. Note the value of the variable number is a function input. Be sure not to overwrite this value in your code. Be sure to assign values to each of the output variables. 1 function [whats Left, divisionCount] = divideBySeven (number) 2 % Enter the code for your function here. 3 divisionCount = uint8(0); % (this needs to be used as an uint8 datatype) while number >= 1 4 5 divisionCount = divisionCount+1; number/7; number 7 end 8 whats Left = number; 9 end 10 Code to call your function > 1 [whats Left, divisionCount] = divideBySeven (256) C Reset Does solution use a while loop? * Are both outputs correct for an input that is a random number in the thousands? Variable divisionCount must be of data type double. It is currently of type uint8. Check where the variable is assigned a value. If your solution passed the first two tests, but not this one, it may be that you have hard coded the input number of 256 from the "Code to call your function" box instead of using the value in the function input variable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
