Bantu temanmu belajar dengan menambahkan soal di Kujawab. Klik disini..

Olimpiade Sains Kota (OSK) 2016 - Komputer , Nomor 46

46
const
MAXS = 10;
var
i, n : integer;
A : array[1..10] of integer;
procedure klik();
begin
dec(i);
end;
function klek(x : integer) : integer;
begin
if(x = MAXS) then klek := A[x] * A[1]
else klek := A[x] * A[x+1];
end;
function klok() : integer;
var
tmp : integer;
begin
if(i = 0) then klok := i
else begin
tmp := i;
klik();
klok := klok() + klek(tmp);
end;
end;
begin
A[1] := 1; A[2] := 2; A[3] := 3; A[4] := 4; A[5] := 5;
A[6] := 6; A[10] := 11; A[9] := 9; A[7] := 8; A[8]:=7;
read(n);
i := n;
writeln(klok());
end.

Apakah output program di atas jika diberi input 8?
a. 240
b. 235
c. 237
d. 330
e. 327