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.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views1 page
Q & A Algorithm
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.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
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