2. Write a program to determine whether an input credit number is valid according to the Luhn check. Prompt the user for a credit card number as a long integer and display whether the number is valid.
Need help creating a method for this process, im unsure how to check a set of long numbers and iterate the steps. Please help me with.........
The Luhn check is performed as follows:
Step 1: Double every second digit from the right to the left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number.
Step 2: Now add all single-digit numbers from Step 1.
Step 3: Add all the digits in the odd places from right to left in the card number.
Step 4: Sum the results from Step 2 and Step 3.
Step 5: If the result from Step 4 is divisible by 10, the card number is valid; otherwise it is invalid.