24 lines
500 B
Text
24 lines
500 B
Text
|
|
#define limite 19
|
||
|
|
|
||
|
|
Function isDisarium(n As Integer) As Boolean
|
||
|
|
Dim As Integer digitos = Len(Str(n))
|
||
|
|
Dim As Integer suma = 0, x = n
|
||
|
|
While x <> 0
|
||
|
|
suma += (x Mod 10) ^ digitos
|
||
|
|
digitos -= 1
|
||
|
|
x \= 10
|
||
|
|
Wend
|
||
|
|
Return Iif(suma = n, True, False)
|
||
|
|
End Function
|
||
|
|
|
||
|
|
Dim As Integer cont = 0, n = 0, i
|
||
|
|
Print "The first"; limite; " Disarium numbers are:"
|
||
|
|
Do While cont < limite
|
||
|
|
If isDisarium(n) Then
|
||
|
|
Print n; " ";
|
||
|
|
cont += 1
|
||
|
|
End If
|
||
|
|
n += 1
|
||
|
|
Loop
|
||
|
|
Sleep
|