Question: Write a C program with the code given that satisfies the following characteristics (1-4) and is able to verify card numbers: For this project, you

 Write a C program with the code given that satisfies the

Write a C program with the code given that satisfies the following characteristics (1-4) and is able to verify card numbers:

For this project, you will implement a function that validates Visa credit card numbers. The function will take an unsigned long long int and return an int. A file is provided for you to complete. You only need to implement the function. You must match the function prototype given. You will receive a 0 if your function implementation does not match the given prototype. Do not add any global variables.

A valid Visa credit card has the following properties:

  • starts with a 4
  • is 16 digits long
  • the Luhn algorithm results in a value that is a multiple of 10 (value % 10 = 0)

Here is a description of the Luhn algorithm using the number 4388576018402626.

  1. Starting with the rightmost digit, add every other digit.

6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38

  1. Double every other digit starting with the second digit from the right. If doubling of a digit results in a two-digit number, add the two digits to get a single-digit number.

2 * 2 = 4

2 * 2 = 4

4 * 2 = 8

1 * 2 = 2

6 * 2 = 12 (1 + 2 = 3)

5 * 2 = 10 (1 + 0 = 1)

8 * 2 = 16 (1 + 6 = 7)

4 * 2 = 8

Add all the single digit numbers.

4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37

  1. Sum the results from Steps 2 and 3.

38 + 37 = 75

  1. If the result from step 3 is divisible by 10, the credit card number is valid. Otherwise the number is invalid.

PreviousNext

int isValidCc (unsigned long long int CCNumber) int main) unsigned long long int cCNumbers[- 4388576018410707ULL, // valid 4388576018402626ULL, 1/ invalid 7388576018402686ULL, // invalid 438857601810707ULL, // invalid 4012888888881881ULL /7 valid yi for (int i - 0; i

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!