fork download
  1. Namespace System.Collections.Generic
  2. Module VBModule
  3. Sub Main()
  4. console.writeline("Enter ISBN:")
  5. Dim isbn As String = console.readline()
  6. isbn = isbn.Replace("-","")
  7. Dim length As Integer = len(isbn)
  8. Dim counter As Integer = 0
  9. Dim isbn_list As New List (Of Integer)
  10. Dim looping As Boolean
  11. Do Until looping = False
  12. Dim num As Integer = Convert.toInt32(isbn.Substring(counter,counter+1))
  13. isbn_list.Add(num)
  14. counter += 1
  15. If counter = Length-1 Then
  16. looping = False
  17. End If
  18. Loop
  19. console.writeline(isbn_list(1))
  20. counter = 0
  21. Dim sum As Integer = 0 'Haha... Dim Sum
  22. Do Until counter = length - 1
  23. If counter Mod 2 = 0 Then
  24. sum += isbn_list.Item(counter)
  25. Else
  26. sum += (isbn_list(counter))* 3
  27. End If
  28. Loop
  29. Dim check As Integer = sum Mod 10
  30. If check = isbn_list(length) Then
  31. console.writeline("You entered a valid code.")
  32. Else
  33. console.writeline("You entered an invalid code.")
  34. End If
  35. End Sub
  36. End Module
Runtime error #stdin #stdout #stderr 0.09s 36520KB
stdin
Standard input is empty
stdout
Enter ISBN:
stderr
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at System.Collections.Generic.VBModule.Main () [0x00000]