1 Desember 2011

Algoritma Mengurutkan Data Secara Ascending dan Descending

Judul :  Algoritma mengurutkan data secara ascending dan descending
Spesifikasi : {Menampilkan data yang sudah terurut secara ascending dan descending, dengan data yang di inputkan dari keyboard. Menampilkan data yang sudah terurut }

Deklarasi:
             data[10] : integer
             ascending[10] : integer
             descending[10] : integer
             i : integer
             x : integer
Deskripsi :
             write(“Masukkan bilangan sebanyak 10 kali”)
             for i=0 to 10
                             read(“a[“,i,”]”)
                             write(“Data sebelum disorting = “)
                             for i = 0 to 10
                                             write(data[i],” “)
                                             for j=0 to 10
                                                             for k=0 to 10
             if data[j] < data[k] then
                             x data[j]
                             data[k] x
                             write(“Data Ascending = “)
             for i=0 to 10
             write(data[i],” “)
             for j=0 to 10
                             for k=0 to 10
                                             if data[j] > data[k] then
                                                             x data[j]
                                                             data[k] <– x
                                                             write(“Data Descending = “)
                                                                             for i = 0 to 10
                                                                             write(data[i],” “)

0 komentar:

Posting Komentar

Silakan tinggalkan komentar Anda....