Kamis, 01 Desember 2011

belajar mengurutkan bilangan menggunakan 2 for ,,,,,,,next,,,,,,,,

cls
input"jumlah data";n
dim x(n)
for i=1 to n
input x(i)
next i

for i=1 to n-1
for j=i + 1 to n
if x(i) > x(j) then
a = x (i)
x(i)=x(j)
x(j)=a
end if
next j
next i
for i = 1 to n
print x(i)
next i

1 komentar: