Question: Write a C program that reads from the standard input a sequence of credit card numbers (the sequence may or may not contain non-digits) each

Write a C program that reads from the standard input a sequence of credit card numbers (the sequence may or may not contain non-digits) each in a separate line, until EOF. The following table shows the credit card number for the major credit cards. The number consists of digits only. The prefix is the left-most digits in the card number. The length is the number of digits in the card number including the prefix.

Write a C program that reads from the standard input a sequence

Then display one of the following 2 messages for every card number read:

** If the number is valid, then display VALID followed by (VISA, MC, or AMEX) followed by a new line. There is exactly one space between valid and the card name.

** If the number is not valid, display INVALID NUMBER followed by a new line.

CARD TYPE Prefix Lengtlh MASTERCARD51-5:5 VISA AMEX 16 4 34 37 13, 16 15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!