This is a Credit Card # Validation program using the Luhn Algorithm, a simple mod 10 checksum formula

or input CC # below
Given CC num:








CC calculated check digit:
Correct CC num:

See: Luhn Algorithm on Wikipedia: https://en.wikipedia.org/wiki/Luhn_algorithm

The Luhn Algorithm was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.

The Luhn Algorithm will detect any single-digit error, as well as almost all transpositions of adjacent digits. It will not, however, detect transposition of the two-digit sequence 09 to 90 (or vice versa). It will detect most of the possible twin errors (it will not detect 22 <=> 55, 33 <=> 66 or 44 <=> 77). Other, more complex check-digit algorithms (such as the Verhoeff algorithm and the Damm algorithm) can detect more transcription errors. The Luhn mod N Algorithm is an extension that supports non-numerical strings.

See: Payment card number on Wikipedia: https://en.wikipedia.org/wiki/Payment_card_number
See: Anatomy of a CC: https://www.creditcardinsider.com/learn/anatomy-of-a-credit-card/