In my last post I was talking about the contest which was organised. There was a particular question. This is the question –
E-Commerce R-Us recently discovered that their e-commerce site did not include a credit card number verification operation on the data that the user submitted for buying their software. The company decided to hire you and your team to develop a credit card validation program. You will be provided with a credit card number with the length varying from 13 digits to 16 digits. The algorithm is a simple mod 10 operation. Each number of the credit card is weighted by either 2 or 1. The credit card number must be zero-filled on the left to create a sixteen digit number, and then the pattern starts with 2, alternating with a 1. If the number multiplied by the weight results in a 2-digit number, each digit is added to the sum. The final sum with the check digit should be a multiple of 10.
Input Format: The user will provide you with a credit card number without spaces.
Output Format: The program will return “Valid” or “Invalid” depending on the success or failure of the check digit.
Input: 5499001100120034 Output: Valid Input: 5499001100120036 Output: Invalid
The question is so easy that you needn’t even solve it.
But now comes the main part, a team from 1st year submitted the following solution. Read it and laugh aloud !!😀
long int a;
printf(“enter value of credit card”);