The last digit of a credit card number is the check digit, which protects against transcription errors like an error in a single digit or switching two digits. The following method is used to certify actual card numbers but, for simplicity, we will define it for numbers with 8 digits instead of 16:
a. Starting from the rightmost digit, form the sum of each other digit. For instance , if the credit card number is 43589795, then you form the sum 5 + 7 + 8 + 3 = 23.