Refer to the Figure 3 below.
cin >> num;
do
{
cin >> num;
total = total + num;
counter++;
} while (num != SENTINEL);
Figure 3: Do While Loop
(a) Given the SENTINEL = -111, counter = 0 and total = 0. Determine the output for the following do-while loop in Figure 3 if the input for the num is 20 40 100 60 -111. Provide the tracing table to show the steps.
(10 marks)
(b) Do you identify any issues with this program? Explain.
(5 marks)
(c) Based on your answer in (b), rewrite the correct program to get the correct result.
(10 marks)
Answers
Answered by
0
Answer:
hgffcvnn n nn n bghnbnjhvv
Explanation:
jjhhjikkkoo
nhgfhikn
Answered by
0
Lifting is not a type of friction. All others are types of friction.
Similar questions