DEV Community

Discussion on: Credit card number check

Collapse
tanayg2 profile image
Tanay Gandhi

Very cool! I'm fascinated, why does it work? Is it due to how credit card companies assign card numbers? How would a couple of math operations check the validity of a credit card number?

Collapse
divyajyotiuk profile image
Divyajyoti Ukirde Author

It is used to distinguish valid numbers from mistyped or rather wrong numbers. The check digit is appended to the partial number to generate valid number.