RosettaCodeData/Task/Largest-int-from-concatenated-ints/Run-BASIC/largest-int-from-concatenated-ints.basic
2023-07-01 13:44:08 -04:00

29 lines
482 B
Text

a1$ = "1, 34, 3, 98, 9, 76, 45, 4"
a2$ = "54,546,548,60"
print "Max Num ";a1$;" = ";maxNum$(a1$)
print "Max Num ";a2$;" = ";maxNum$(a2$)
function maxNum$(a1$)
while word$(a1$,i+1,",") <> ""
i = i + 1
a$(i) = trim$(word$(a1$,i,","))
wend
s = 1
while s = 1
s = 0
for j = 1 to i -1
if a$(j)+a$(j+1) < a$(j+1)+a$(j) then
h$ = a$(j)
a$(j) = a$(j+1)
a$(j+1) = h$
s = 1
end if
next j
wend
for j = 1 to i
maxNum$ = maxNum$ ; a$(j)
next j
end function