var head, tail, x : integer; stek: array [1..100] of integer; function pop():integer; begin if (head = tail) then pop := -1 else begin pop := stek[head]; head := head + 1; end; end; begin stek[3] := 5; stek[2] := 3; stek[4] := 7; stek[1] := 1; stek[5] := 9; head := 1; tail := 6; pop(); for x := 1 to 3 do writeln( pop() ); pop(); end.
Jika program tersebut dijalankan, maka pada layar akan tampil:
A. 3
7
1
B. 5
3
7
1
9
C. 3
5
7
D. 1
3
5
7
9
E. 1