Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

image text in transcribed

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 70

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

Why do mergers and acquisitions have such an impact on employees?

Answered: 1 week ago

Question

2. Describe the functions of communication

Answered: 1 week ago