public class Test
public Shared Sub Main
Dim strISBN As String = "078212283"
Console.WriteLine("The check Digit is " & ISBNCheckDigit("078212283") & ".")
Console.WriteLine("The complete ISBN is " & strISBN & ISBNCheckDigit(strISBN) & ".")
End Sub
Shared Function ISBNCheckDigit(ByVal strISBN As String) As String
Dim i, intCheckSum, intCheckDigit As Integer
For i = 0 To 8
intCheckSum = intCheckSum + (10 - i) * strISBN.Substring(i, 1)
Next
intCheckDigit = 11 - (intCheckSum Mod 11)
If intCheckDigit = 10 Then
Return ("X")
Else
Return (intCheckDigit.ToString)
End If
End Function
End class
The check Digit is 3.
The complete ISBN is 0782122833.