Describe the four basic elements of counter-controlled iteration. Compare and contrast the while and for iteration state
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Describe the four basic elements of counter-controlled iteration. Compare and contrast the while and for iteration state
Describe the four basic elements of counter-controllediteration.Compare and contrast the while and for iterationstatements.Discuss a situation in which it would be more appropriate touse a do...while statement than a while statement. Explain whythis is important to know.Compare and contrast the break and continue statements.Fill in the blank:The do...while statement tests the loop-continuation condition________ executing theloop’s body; therefore, the body always executes at leastonce.Fill in the blank:The for-loop statement tests the loop-continuation condition________ executing the loop’sbody; therefore.What statement, when executed in an iteration statement, skipsthe remaining statementsin the loop body and proceeds with the next iteration of theloop?Write a Java statement or a set of Java statements toaccomplish the following task:Compute the sum the even integers between 100 and 999, using a forstatement. Assumethat the integer variables sum and count have been declared.Write a Java statement or a set of Java statements toaccomplish the following task:Compute the sum the integers that are multiples of 4 and 7, between100 and 999, using afor statement. Assume that the integer variables sum and count havebeen declared.Write a Java statement or a set of Java statements toaccomplish the following task:Display the values: 1, 4, 7, 10, 13, 16, ... out to 25 terms, usinga for statement (hint: theequation for these values are: y = 3x + 1, with x starting atzero). Determine the value of the variables my_val and x, in thestatement my_val *= --x; after the calculation is performed. Assumethat the variables are type int and initially have the values of 5for my_val and the value of 8 for the variable x.Determine the value of the variables my_val and x, in thestatement my_val %= ++x; after the calculation is performed. Assumethat the variables are type int and initially have the values of 35for my_val and the value of 8 for the variable x.