Question
I need help writing a C program to validate credit card numbers. I have the directions posted below. And the code I have so far.
I need help writing a C program to validate credit card numbers. I have the directions posted below. And the code I have so far. The replies I have gotten so far have been very confusing to me. Here is a picture showing an example of having the numbers looped through.
Code:
#include
#include
#include
int stripper(long long longNumber, int digitNumber) {
return ((longNumber - ((long long)(longNumber / pow(10, digitNumber))*pow(10, digitNumber))) / pow(10, digitNumber - 1));
}
int isOdd(long int digit)
{
if (digit % 2 == 0)
return 0;
else
return 1;
}
int main()
{
printf("Please enter credit card number");
scanf_s();
long long testNumber = 5120415296389632; //long long is a data type for a large integer
getchar();
return 0;
}
Account number Double every odd digit Sum 5 1 2 0415 29 63 8 96 3 2 10 1408 1 10 2 1866 8 186 6 2 1 140 81 12 9668 9662 70Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started