Code has already been provided to define a function named divideBySeven that accepts a single input...
Fantastic news! We've Found the answer you've been seeking!
Question:
![image text in transcribed](https://s3.amazonaws.com/si.experts.images/answers/2024/05/664780792ab9f_97666478078f2e17.jpg)
![image text in transcribed](https://s3.amazonaws.com/si.experts.images/answers/2024/05/6647807985e43_977664780796a79f.jpg)
![image text in transcribed](https://s3.amazonaws.com/si.experts.images/answers/2024/05/66478079e9300_97766478079cd9a7.jpg)
Transcribed Image Text:
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. 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.
Expert Answer:
Posted Date:
Students also viewed these mechanical engineering questions
-
A random sample of n = 77 data items hasx = 105 and s = 24. What is the 80% confidence interval estimate of ?
-
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...
-
Calculate the macroscopic absorption cross section for aluminum given that a thermal flux of 2.91x10 8 neutrons/cm sec (E = 0.0253 eV) is incident on a 4.8 mm thick aluminum foil, and that after...
-
Find the maximum of f(x,y) = x + y - x - y - xy
-
Why must we be concerned about privacy in the sharing and use of a financial-service customers information? Can the financial system operate efficiently if sharing nonpublic information is forbidden?...
-
Scientists now think they have a complete understanding of the process of cloning. True/False
-
The Stancil Corporation provided the following current information. Determine the cash flow for the Stancil Corporation. Proceeds from short-term borrowing Proceeds from long-term borrowing Proceeds...
-
On January 1, 2012, Crume Incorporated issued bonds with a face value of $100,000, a stated rate of interest of 9 percent, and a five-year term to maturity. Interest is payable in cash on December 31...
-
Thank you for the help. Goshford Company produces a single product and has capacity to produce 115,000 units per month. Costs to produce its current sales of 92,000 units follow. The regular selling...
-
1. Stock Premium and additional paid in capital are not the same. T or F? 2. The closing entry when the result of operation is a net income for a corporation is a credit to retained earnings. T or F?...
-
How do major social institutions (such as family, religion, education, and government) adapt to changing social norms and values? What are the key factors driving institutional change in modern...
-
Inside a flat layer of thickness D=10 cm there is a uniform charge distribution with density p=1C/m. In the layer there is also a spherical cavity, free of charge, of radius R= D/2, centered on the...
-
what extent has secularization altered the role of religion in public life? Analyze the impact of secularization on moral values, social cohesion, and cultural identity.
-
Discuss the role of advanced traffic simulation models, such as microscopic traffic flow models and agent-based modeling, in evaluating the performance and reliability of transportation networks...
-
The radius of the earth's orbit around the sun (assumed to be circular) is 1.50 108 km, and the earth travels around this orbit in 365 days. (a) What is the magnitude of the orbital velocity of the...
-
What guidance has the Office of Federal Procurement Policy (OFPP) issued that addresses misconceptions and details best practices for communicating with varies communities, including vendors? Vendor...
-
Anna, a high school counselor, devised a program that integrates classroom learning with vocational training to help adolescents at risk for school dropouts stay in school and transition to work...
-
The trial balance of Jeremina plc as at 31 March 2002 is as follows: (i) Stock of finished goods on 31 March 2002 163,000. (ii) Motor expenses and depreciation on motors to be apportioned:...
-
You are Br erired: with the following information relating to Plott plc for the year to 31 March 2011: Additional information: 1. The above information has been obtained after the compilation of the...
-
The following information has been extracted from the books of Quire plc as at 30 September 2011. The following additional information is to be taken into account: 1. Stocks at 30 September 2011 were...
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App