RosettaCodeData/Task/Numbers-with-equal-rises-and-falls/OxygenBasic/numbers-with-equal-rises-and-falls.basic
2026-04-30 12:34:36 -04:00

31 lines
628 B
Text

uses console
function eqrf(n as long) as boolean
dim as string sn = str(n)
dim as integer q = 0
long i
for i = 2 to len(sn)
if asc(mid(sn,i,1)) > asc(mid(sn,i-1,1)) then
q += 1
elseif asc(mid(sn,i,1)) < asc(mid(sn,i-1,1)) then
q -= 1
end if
next i
if q = 0 then return true else return false
'return iif(q = 0, True, false)
end function
dim as long c = 0, i = 1
while c < 10000001
if eqrf(i) then
c += 1
if c <= 200 then print i " ";
if c = 1e7 then printl cr i
end if
i += 1
wend
printl cr "Enter ..."
waitkey