Yuk bantu teman kamu belajar dengan menambahkan soal di Kujawab. Klik disini..

Olimpiade Sains Kota (OSK) 2018 - Komputer , Nomor 35

35
var arr: array[1..10] of integer;
 i, j, s: integer;
begin
    for i := 1 to 10 do
         arr[i] := i + 1;
    for i := 1 to 10 do
    begin
         for j:= i+1 to 10 do
         begin
            if (arr[i] = -1)then break;
               s := arr[j] div arr[i];
               if (s * arr[i] = arr[j]) then
               begin
                   arr[i] := arr[i] + arr[j];
                   arr[j] := arr[i] - arr[j];
                   arr[i] := arr[i] - arr[j];
                   arr[i] := -1;
               end;
         end;
    end;
end.

Berapa nilai dari arr[9] setelah program selesai dijalankan ?

a. -1

b. 0

c. 2

d. 5

e. 10