<strong>Question for test</strong>
Credit card numbers follow certain patterns. A credit card number must have between 13
and 16 digits. The starting numbers are: 4 for Visa cards, 5 for MasterCard cards, 37 for
American Express cards, and 6 for Discover cards.
Example: Validating 4 3 8 8 5 7 6 0 1 8 4 0 2 6 2 6
a) Double every second digit from right to left. If doubling of a digit results in
a two-digit number, add the two digits to get a single digit number.
b) Now add all single-digit numbers from Step a:
4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37
c) Add all digits in the odd places from right to left in the card number:
6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38
d) Sum the results from Step b and Step c:
37 + 38 = 75
e) If the result from Step d is divisible by 10, the card number is valid;
otherwise, it is invalid