23 lines
394 B
Text
23 lines
394 B
Text
function isDisarium(n)
|
|
digitos = length(string(n))
|
|
suma = 0
|
|
x = n
|
|
while x <> 0
|
|
suma += (x % 10) ^ digitos
|
|
digitos -= 1
|
|
x = x \ 10
|
|
end while
|
|
if suma = n then return True else return False
|
|
end function
|
|
|
|
limite = 19
|
|
cont = 0 : n = 0
|
|
print "The first"; limite; " Disarium numbers are:"
|
|
while cont < limite
|
|
if isDisarium(n) then
|
|
print n; " ";
|
|
cont += 1
|
|
endif
|
|
n += 1
|
|
end while
|
|
end
|