Related questions with answers
Question
What type of loop, such as counter-control or sentinel-control, will you use in each of the following situations? a. Sum the following series: 1 + (2 / 1) + (3 / 2) + (4 / 3) + (5 / 4)+ ... + (10 / 9) b. Sum the following numbers, except the last number: 17, 32, 62, 48, 58, -1 c. A file contains an employee’s salary. Update the employee’s salary.
Solution
VerifiedAnswered 2 years ago
Answered 2 years ago
Step 1
1 of 4a. Counter-Controlled Loop
In such situations, we can use a counter-controlled while loop. Because it uses a counter to control the loop. In a counter-controlled while loop, we must initialize the counter before the loop, and the body of the loop must contain a statement that changes the value of the counter variable.
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
More related questions
1/4
1/7