RosettaCodeData/Task/Eban-numbers/OxygenBasic/eban-numbers.basic

55 lines
1.2 KiB
Plaintext

uses console
! GetTickCount lib "kernel32.dll"
double t1, t2
sub eban (start as int, ended as int, printable as int)
int contar
long i, b, r, m, t
contar = 0
if start = 2 then
printl "eban numbers up to and including " ended ":"
else
printl "eban numbers between " start " and " ended " (inclusive):"
end if
for i = start to ended step 2
b = (i \ 1000000000)
r = mod(i, 1000000000)
m = (r \ 1000000)
r = mod(i, 1000000)
t = (r \ 1000)
r = mod(r, 1000)
if m >= 30 and m <= 66 then m = mod(m, 10)
if t >= 30 and t <= 66 then t = mod(t, 10)
if r >= 30 and r <= 66 then r = mod(r, 10)
if b = 0 or b = 2 or b = 4 or b = 6 then
if m = 0 or m = 2 or m = 4 or m = 6 then
if t = 0 or t = 2 or t = 4 or t = 6 then
if r = 0 or r = 2 or r = 4 or r = 6 then
if printable then print i " ";
contar += 1
end if
end if
end if
end if
next i
if printable then print cr
printl "count = " contar cr
end sub
t1 = GetTickCount
call eban (2, 1000, 1)
call eban (1000, 4000, 1)
call eban (2, 10000, 0)
call eban (2, 100000, 0)
call eban (2, 1000000, 0)
call eban (2, 10000000, 0)
call eban (2, 100000000, 0)
t2 = GetTickCount
printl "Run time: " (t2-t1)/1000 " seconds."
printl cr "Enter ..."
waitkey