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 commands
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 whatsLeft. Count the number of divisions required and assign the result to the output variable divisionCount with unsigned 8-bit integer datatype. 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.
Starter code:
function [whatsLeft, divisionCount] = divideBySeven(number)
%Enter the code for your function here.
Your Function C Reset I MATLAB Documentation 1 function [whatsLeft, divisionCount] = divideBySeven(nui 2 %Enter the code for your function here. 3 Code to call your function C Reset 1 [whatsLeft, divisionCount] = divideBySeven(256) Run Function
Step by Step Solution
3.37 Rating (163 Votes )
There are 3 Steps involved in it
Here is the code whatsLeft divisionCount divideBySeven256 function whatsLeft ... View full answer
Get step-by-step solutions from verified subject matter experts
