Dim tot As String = "0"
Dim ADD As String = "234567892345"
Dim Input As String
Console.WriteLine("주민등록번호를 입력하세요")
Console.WriteLine("(입력 형식 : 1234561234567)")
Input = Console.ReadLine()
If Input.Length <> 13 Then
Console.WriteLine("잘못된 입력, 프로그램 종료")
Else
Dim i As Integer = 0
For i = 0 To 11 Step 1
tot = tot + Input.Substring(i, 1) * ADD.Substring(i, 1)
Next
tot = 11 - (tot Mod 11)
If tot = 10 Then
tot = 0
ElseIf tot = 11 Then
tot = 1
End If
If Input.Substring(12, 1) = tot Then
Console.WriteLine("입력하신 주민등록번호는 올바른 주민등록번호 입니다.")
Else
Console.WriteLine("입력하신 주민등록번호는 잘못된 주민등록번호입니다.")
End If
End If
VB.NET - Console Application 으로 주민등록번호 진위 여부 확인하는 Code

