The algorithm takes in a set of marks as input, adds them to a running sum if the counter is less than or equal to 4, and increments the counter each time. It stops when the input mark is -100 and prints out the final sum and counter value.
The algorithm takes in a set of marks as input, adds them to a running sum if the counter is less than or equal to 4, and increments the counter each time. It stops when the input mark is -100 and prints out the final sum and counter value.
Study the algorithm below and answer the questions that follow.
(NB. In this algorithm <= implies less than or equal to)
Set counter to zero Begin Input mark If counter <=4 then Add 1 to counter Add mark to sum End if Until mark =-100 Print sum Print counter (i)Complete the trace table for the algorithm using the following set of marks: 25, 20, 23, 24, 20, 30,-100