king

Home » , , , » Program ascendin and descending melalui Turbo Basic

Program ascendin and descending melalui Turbo Basic

Program acendin and descending

dim a(10)
cls
print"PROGRAM ASCENDING DAN DISCENDING"
print
print
for i=1 to 10
input"masukan angka: ",a(i)
next i
cls
print"data"
for i=1 to 10
locate 3+i,2:print a(i)
next i
for y=1 to 10-1
for j=1 to 10-1
if a(j) > a(j+1) then
proses = a(j)
a(j) = a(j+1)
a(j+1) =proses
end if
next j
next y
locate 1,14:print"ascending"
for i=1 to 10
locate 3+i,17:print a(i)
next i


for x=1 to 10-1
for j=1 to 10-1
if a(j) < a(j+1) then
proses = a(j)
a(j) = a(j+1)
a(j+1) =proses
end if
next j
next x

locate 1,28:print"discending"
for i=1 to 10
locate 3+i,30:print a(i)
next i
end

0 komentar: