Numbers with equal rises and falls: Difference between revisions

Added PureBasic
(Numbers with equal rises and falls in BASIC256 and Gambas. Grouping BASIC dialects)
(Added PureBasic)
Line 610:
 
End Function</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
==={{header|PureBasic}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="PureBasic">Procedure.b eqrf(n.i)
sn.s = Str(n)
q.i = 0
For i.i = 2 To Len(sn)
If Asc(Mid(sn, i, 1)) > Asc(Mid(sn, i - 1, 1)):
q + 1
Else
If Asc(Mid(sn, i, 1)) < Asc(Mid(sn, i - 1, 1)):
q - 1
EndIf
EndIf
Next
If q = 0:
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
 
OpenConsole()
c.i = 0
i.i = 1
While c < 10000001
If eqrf(i):
c + 1
If c <= 200:
Print(" " + Str(i))
EndIf
If c = 10000000:
PrintN(#CRLF$ + Str(i))
EndIf
EndIf
i + 1
Wend
 
Input()
CloseConsole()</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
2,123

edits