76 984
Assignments Done
98,5%
Successfully Done
In June 2019

Answer to Question #43046 in C++ for nona

Question #43046
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
Expert's answer

Not answered

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions