Question: I need help writing a program to output if the credit card number 5120415296389632 is valid or invalid. I have a function that inputs are
I need help writing a program to output if the credit card number 5120415296389632 is valid or invalid. I have a function that inputs are the credit card number and the digit number to be stripped off. It will return the number that is in that digit. I am writing in c program language. This is what I have so far.
---------------------------------------------------------------------------
#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 main()
{
long long testNumber = 5120415296389632; //long long is a data type for a large integer
/* Comments */
getchar();
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
