This Project is all about checking if the entered Credit Card number is valid or not. C++ Programming Language is used in this project.

This Module is designed using C++. Here User should input Integer and This module Outputs if the entered integer is valid or not for a Credit Card Number. Credit Card Number follow certain patterns. Credit Card Number should have between 13 to 16 digits. It should start with

a) 4 for visa cards

b) 5 for master cards

c) 6 for Discover Cards

d) for American Express Cards

This problem is solved using Luhn Algorithm or the Mod 10 check, which is described as follows

Consider the card number 5196081888500645

step 1. Scan the input number from right to left and double every second digit. if doubling results in a two-digit number, add the two digits to get a single-digit number.

Ex:- 14 is written as 1+4

step 2. From step1 add all the single-digit numbers.

8+0+1+7+2+0+9+1 = 28

step 3. Now add all the digits in the odd places from right to left in the card number.

5+6+0+8+8+8+6+1 = 42

step 4. Add the results from the above two steps.

28 + 42 = 70

step 5. If the result from the above step is divisible by 10 then we can say the card number is valid; otherwise, it is invalid.

Examples:

Input: 5196081888500645

Output: 5196081888500645 is valid

Input: 4388576018402626

Output: 4388576018402626 is invalid

Submitted by Kothapally Nehasai (Neha1292)

Download packets of source code on Coders Packet