Question: by using : Dev - C++ Writing a program that detects whether a credit card number is valid. VISA credit cards start with 4, MASTERCARD
by using : Dev-C++
Writing a program that detects whether a credit card number is valid. VISA credit cards start with 4, MASTERCARD credit cards start with 5. The program will indicate whether the card is valid, as well as the card type.
The algorithm used to determine the validity of the card is known as the LUHN algorithm and it works as follows:
1- Starting from the second to last digit, multiply each second digit by 2 and add each of the numbers that result from their product.
2-Add the sum to the sum of the digits of the numbers not multiplied by 2.
3- If the last digit of the total is 0, the number is valid.
Dev-C++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
