Write a c program that reads a credit card number from the user. The c program will
display:
Valid: if the credit card is valid
Invalid: if the credit card is invalid
The program will also display the type of the credit card according to the starting digit
(1st
digit from left to right). The credit card number must start with:
3 for American Express
4 for Visa
5 for MasterCard
6 for Discover Card
The total number of digits of a credit card number must be between 13 to 16 digits. In
addition, your program should validate credit card numbers according to Luhn Rule
that is basically can be described as follows (as an illustration, the rules will be applied to
the credit card number 4388576018402626):
1. Double every even digit from right to left. If the doubling results in two digits
number, sum the digits to get a single digit number.
2. Compute the sum of single digit numbers obtained from step 1 above:
Sum of even single-digits = 4 + 4 + 8 + 2 + 3 + 1 + 7

## Comments

## Leave a comment