Halloween party ideas 2015

Program ini digunakan utum mengurutkan angka atau nulai dari yang terkecil ke nilai yang besar

 1: Program Pengurutan;
 2: var i, j: integer;
 3:   k : longint;
 4:   a : array[1..5] of longint;
 5: begin
 6:   writeln('PROGRAM MENGGURUTKAN ANGKA');
 7:   writeln('--------------------------');
 8:   for i:=1 to 4 do
 9:   begin
10:     write('Masukkan bilangan ke- ', i, ' : ');
readln(a[i])
11:   end;
12:   for j:=2 to 4 do
13:   begin
14:     k:=a[j];
15:     i:=j-1;
16:     while (i>0) and (a[i]>k) do
17:     begin
18:       a[i+1]:=a[i];
19:       i:=i-1;
20:     end;
21:     a[i+1]:=k
22:   end;
23:   for i:=1 to 4 do
24:     writeln(a[i]);
25:   readln;
26: end.

Post a Comment

This blog needed you to understand the word spam - never spam on this blog, although i will not moderate all of it, but you will learn it yourself, educate yourself

Powered by Blogger.