30 likes | 108 Vues
Hand execute the program with inputs 20, 7, -1. Variables Table. SET total TO 0 RECEIVE nextInput FROM (INTEGER) KEYBOARD WHILE nextInput != -1 DO SET total TO total + nextInput RECEIVE nextInput FROM (INTEGER) KEYBOARD END WHILE SEND total TO DISPLAY.
E N D
Hand execute the program with inputs 20, 7, -1 Variables Table SET total TO 0 RECEIVE nextInput FROM (INTEGER) KEYBOARD WHILE nextInput != -1 DO SET total TO total + nextInput RECEIVE nextInput FROM (INTEGER) KEYBOARD END WHILE SEND total TO DISPLAY Expression evaluator
Hand execute the program with 13 as the input for searchKey Variables Table SET found TO FALSE SET numList TO [8,9,13,4] RECEIVE searchKey FROM (INTEGER) KEYBOARD SET pos TO 0 WHILE found TRUE AND pos < length (numList) DO IF numList [ pos ] = searchKey THEN SET found TO TRUE ELSE SET pos TO pos + 1 END IF END WHILE Expression evaluator
Descriptions SET lotto_player TO [“”, ””, ””, ””] FOR player FROM 0 TO 2 DO SEND “Please enter players name” TO DISPLAY RECEIVE name FROM (STRING) KEYBOARD SET lottoPlayer[ player ] TO name END FOR selected = pick_random( 0, 2 ) SEND lotto_player [ selected ] & “has won!” TO DISPLAY