Implementation of the Luhn algorithm to validate a credit card.
The algorithm in the video won't work with AMEX card numbers. I have modified the code in order to accommodate credit card numbers that have odd lengths. The fix is to simply start counting from the right and begin doubling with the second-to-last number. However, if the number is even, the algorithm in the video still holds true.
Source code: https://github.com/tobymac208/YouTube...
Website with example credit card numbers to try: https://www.simplify.com/commerce/doc...
Detailed explanation of the algorithm from CS50: https://cs50.harvard.edu/college/2020...