A credit card number must have between 13 and 16 digits, and this can be checked by using Luhn algorithm.
Steps involved in the Luhn algorithm
Step 1 – Starting from the rightmost digit, double the value of every second digit,
Step 2 – If doubling of a number results in a two digit number then add the digits of the product
to get a single digit number.
Step 3 – Now take the sum of all the digits.
Step 4 – If the total modulo 10 is equal to 0 (if the total ends in zero)
then the number is valid according to the Luhn formula; else it is not valid.
-
Notifications
You must be signed in to change notification settings - Fork 0
saidathu-lalam/CreditCard-validation
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published