Task 1 Task 2 Task 3

Task 1

count = 0

loop i from 0 to 5

output "Enter a number"

input num

if num > 0 then

count = count + 1

end if

end loop

Complete a following trace table for the above algorithm. The test data is:

-11 0 5 3 -1 6
count i num
     

Task 2

i ← 0

repeat

output "Enter a number between 1 and 10:"

input playerNum

if playerNum > 5 then

i = i + 1

end if

if playerNum < 5 then

i = i - 1

end if

untl playerNum = -1

output "i is ", i

Complete a trace table for the above algorithm. The test data is:

8 7 5 0 3 8 -1
i playerNum PRINT
     

Task 3

count = 0

total = 0

loop i from 0 to 5

output "Enter a temperature as a real number:"

input temp

total = total + temp

if temp > 28.0 then

count = count + 1

end if

end loop

average = total/6

Take a paper and pencil and complete the following trace table for the above algorithm. The test data is:

25.2 29.0 27.4 28.8 31.1 30.0
count total i temp average