Module Module1
Sub Main()
Dim T As String = "0"
Dim Temp As String = "0"
Dim Key As String = "2121212121212121"
Dim Input As String
Console.WriteLine("카드 번호 16자리를 입력하세요")
Console.WriteLine("(입력 형식 : 1234567891234563)")
Input = Console.ReadLine()
If Input.Length <> 16 Then
Console.WriteLine("잘못된 입력, 프로그램 종료")
Else
Dim i As Integer = 0
For i = 0 To Input.Length - 1
T += Int((Input.Substring(i, 1) * Key.Substring(i, 1)) / 10) + Int((Input.Substring(i, 1) * Key.Substring(i, 1)) Mod 10)
Next
T = T Mod 10
If T = 0 Then
Console.WriteLine("올바른 카드번호")
Else
Console.WriteLine("잘못된 카드번호")
End If
Console.WriteLine(T)
End If
End Sub
End Module
신용카드 확인하는 소스이긴 하나..
뭐.. 카드사 마다 틀리겠지요...ㅠ (수업용...자료로.. 활용하시길..)