Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Function selfDescribing (n As UInteger) As Boolean
|
||||
If n = 0 Then Return False
|
||||
Dim ns As String = Str(n)
|
||||
Dim count(0 To 9) As Integer '' all elements zero by default
|
||||
While n > 0
|
||||
count(n Mod 10) += 1
|
||||
n \= 10
|
||||
Wend
|
||||
For i As Integer = 0 To Len(ns) - 1
|
||||
If ns[i] - 48 <> count(i) Then Return False '' numerals have ascii values from 48 to 57
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Print "The self-describing numbers less than 100 million are:"
|
||||
For i As Integer = 0 To 99999999
|
||||
If selfDescribing(i) Then Print i; " ";
|
||||
Next
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue