RosettaCodeData/Task/Harshad-or-Niven-series/PureBasic/harshad-or-niven-series.basic
2023-07-01 13:44:08 -04:00

16 lines
309 B
Text

If OpenConsole()=0 : End 1 : EndIf
Procedure.i Niven(v.i)
w=v
While v : s+v%10 : v/10 : Wend
If w%s=0 : ProcedureReturn w : EndIf
EndProcedure
Repeat
i+1
If Niven(i) : c+1 : Print(Str(i)+" ") : EndIf
If c=20 And i<1000 : Print("... ") : i=1000 : EndIf
If c=21 : Break : EndIf
ForEver
Input()