Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'VisualBasic solution to codeabbey challenge 24
- Imports System
- Module compiler
- Sub Main()
- Dim inp1 As Integer = 12
- Dim inp2() As Integer = {3488, 373, 5368, 751, 8342, 3416, 843, 6173, 7019, 381, 1054, 6303}
- Dim counter As Integer = 1
- Dim a, aux As Integer
- Dim aux2 As Integer
- Dim rsp() As String = {}
- Dim vals() As Integer = {}
- For Each a In inp2
- aux = a
- While true
- aux2 = Fix((aux * aux / 100) MOD 10000)
- If Array.IndexOf(vals, aux2) <> -1 Then
- ReDim Preserve rsp(rsp.Length)
- rsp(rsp.Length-1) = counter.ToString()
- Exit While
- End If
- ReDim Preserve vals(vals.Length)
- vals(vals.Length-1) = aux
- counter += 1
- aux = aux2
- End While
- counter = 0
- Array.Clear(vals,0,vals.Length)
- Next
- Console.WriteLine (String.Join(" ", rsp))
- End Sub
- end Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement