Credit Card Validation Application

Credit Card Validation Application

Write a c program that reads a credit card number from the user. The c program will display: ΓΆβ?¬ΒΆ Valid: if the credit card is valid ΓΆβ?¬ΒΆ Invalid: if the credit card is invalid The program will also display the type of the credit card according to the starting digit (1st digit from left to right). The credit card number must start with: ΓΆβ?¬ΒΆ 3 for American Express ΓΆβ?¬ΒΆ 4 for Visa ΓΆβ?¬ΒΆ 5 for MasterCard ΓΆβ?¬ΒΆ 6 for Discover Card

The total number of digits of a credit card number must be between 13 to 16 digits. In addition, your program should validate credit card numbers according to Luhn Rule that is basically can be described as follows (as an illustration, the rules will be applied to the credit card number 4388576018402626):

  1. Double every even digit from right to left. If the doubling results in two digits number, sum the digits to get a single digit number.

  2. Compute the sum of single digit numbers obtained from step 1 above: Sum of even single-digits = 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37

  3. Compute the sum of every odd digit from right to left: Sum of odd digits = 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38

  4. Compute the sum of the results from step 2 and step 3: Total sum = 37 + 38 = 75

  5. If the total sum from step 4 is divisible by 10, the card number is valid. Otherwise itΓΆβ?¬β?Άs not valid.

Is 75 divisible by 10 (without remainder)? No, the card number in this example is Invalid.

Output Samples:

Enter A Credit Card Number: 5278576018410707 (ENTER) Credit Card Belongs To MasterCard The Credit Card Number is VALID

Enter A Credit Card Number: 4388576018402626 (ENTER) The card Number is INVALID

Enter A Credit Card Number: 601195764182 (ENTER) Number of digits: [ 12 ] The card Number is INVALID

Enter A Credit Card Number: 43885760184026261 (ENTER) Number of digits: [ 17 ] The card Number is INVALID

Enter A Credit Card Number: 373800410401774 (ENTER) Credit Card Belongs To American Express The Credit Card Number is VALID

Note1: you have to use user-defined functions wherever they are needed.

Note2: The credit card number is usually (ex. 438857601840262) larger than what int variable can hold. To solve this problem:

For windows users (C-free IDE), you can use long long int data type as shown in the following example: long long int cardNumber; printf("Enter A Credit Card Number: "); scanf("%lld",&cardNumber);

For Mac users (Xcode IDE), you can use long data type as shown in the following example: long cardNumber; printf("Enter A Credit Card Number: "); scanf("%ld",&cardNumber);

& thank you very much {}.

View Answers









Related Tutorials/Questions & Answers:
Credit Card Validation Application
Credit Card Validation Application   Write a c program that reads a credit card number from the user. The c program will display: ΓΆβ?¬ΒΆ Valid: if the credit card is valid ΓΆβ?¬ΒΆ Invalid: if the credit card is invalid
credit card validation
credit card validation   Double every second digit from right to left... digits in the odd places from right to left in the card number. 6 + 6 + 0 + 8 + 0... is between 13 and 16, then the card number is valid; otherwise, it is invalid. i
Advertisements
Credit Card Validation - Java Beginners
Credit Card Validation  i have to do a project for my comp sci class. yet i dont know how to select the last digit of a credit card number strings... up the digits in the credit card number, working from right to left
credit card problem - Java Beginners
credit card problem  Say that you owe the credit card company $1000.00. The company charges you 1.5% per month on the unpaid balance. You have decided to stop using the card and to pay off the debt by making a monthly payment
Version of com.palindromicstudios>credit-card-view dependency
List of Version of com.palindromicstudios>credit-card-view dependency
Maven Repository/Dependency: com.palindromicstudios | credit-card-view
Maven Repository/Dependency of Group ID com.palindromicstudios and Artifact ID credit-card-view. Latest version of com.palindromicstudios:credit-card-view...? How to create Maven Web Application in Eclipse? Maven 3 Tutorial
Maven Dependency credit-card-view >> 1.0.0
You should include the dependency code given in this page to add Maven Dependency of com.palindromicstudios >> credit-card-view version1.0.0 in your project
How to send request to the visa/master card to get verifed the credit card - Security
How to send request to the visa/master card to get verifed the credit card  Sending request to verify the card number
How to send request to the visa/master card to get verifed the credit card - Security
How to send request to the visa/master card to get verifed the credit card  we are accepting the credit card number, So how to forward request get verified the card number. Thanks You
ModuleNotFoundError: No module named 'kupfer_plugin_credit_card_generator'
ModuleNotFoundError: No module named 'kupfer_plugin_credit_card_generator' ...: ModuleNotFoundError: No module named 'kupfer_plugin_credit_card_generator' How to remove the ModuleNotFoundError: No module named 'kupfer_plugin_credit_card
ModuleNotFoundError: No module named 'kupfer_plugin_credit_card_generator'
ModuleNotFoundError: No module named 'kupfer_plugin_credit_card_generator' ...: ModuleNotFoundError: No module named 'kupfer_plugin_credit_card_generator' How to remove the ModuleNotFoundError: No module named 'kupfer_plugin_credit_card
ModuleNotFoundError: No module named 'odoo10-addon-account-payment-credit-card'
ModuleNotFoundError: No module named 'odoo10-addon-account-payment-credit-card...: ModuleNotFoundError: No module named 'odoo10-addon-account-payment-credit-card' How...-payment-credit-card' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo11-addon-account-payment-credit-card'
ModuleNotFoundError: No module named 'odoo11-addon-account-payment-credit-card...: ModuleNotFoundError: No module named 'odoo11-addon-account-payment-credit-card' How...-payment-credit-card' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo11-addon-account-payment-credit-card'
ModuleNotFoundError: No module named 'odoo11-addon-account-payment-credit-card...: ModuleNotFoundError: No module named 'odoo11-addon-account-payment-credit-card' How...-payment-credit-card' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo12-addon-account-payment-credit-card'
ModuleNotFoundError: No module named 'odoo12-addon-account-payment-credit-card...: ModuleNotFoundError: No module named 'odoo12-addon-account-payment-credit-card' How...-payment-credit-card' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo12-addon-account-payment-credit-card'
ModuleNotFoundError: No module named 'odoo12-addon-account-payment-credit-card...: ModuleNotFoundError: No module named 'odoo12-addon-account-payment-credit-card' How...-payment-credit-card' error? Thanks   Hi, In your python
How to send request to the visa/master card to get verifed the credit card - Security
How to verifed the credit card  Can anyone please explain me ...how to verify the card number while accepting payment online
Shoping Card
Shoping Card  Complete coding for online shoping card
validation
validation  validation
Tomahawk validateCreditCard tag
is used to validate a Credit Card Number entered by the user. If we want the user to enter a valid Credit Card Number then this validation...; <h:form> <t:outputText value="Credit Card Number:"/>
ModuleNotFoundError: No module named 'credit'
ModuleNotFoundError: No module named 'credit'  Hi, My Python... 'credit' How to remove the ModuleNotFoundError: No module named 'credit'... to install padas library. You can install credit python with following command
ModuleNotFoundError: No module named 'credit'
ModuleNotFoundError: No module named 'credit'  Hi, My Python... 'credit' How to remove the ModuleNotFoundError: No module named 'credit'... to install padas library. You can install credit python with following command
Debit Note & Credit Note
Debit Note & Credit Note   hii, What is the Debit Note & Credit Note ?   hello,,ADS_TO_REPLACE_1 Generally no business done without credit a debit note is generally issued by purchaser and credit note
CreditCardValidator in Flex4
for validate a credit card number. It checks the length and correct prefix of the credit... of the credit card number, and the cardTypeSource and cardTypeProperty properties are used to specify the location of the credit card type to validate. The length
complete coding for shopping card
complete coding for shopping card  complete coding for shopping card   Please visit the following link: Shopping Cart Application
validation
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
validation.....
validation.....  hi.......... thanks for ur reply for validation code. but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
JSF Validation In Login Application
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "
What is cash credit
What is cash credit  hello, What is cash credit?   hii,ADS_TO_REPLACE_1 Cash credit means person gives the cash to some another person expecting to get that cash in future date with some premium
ModuleNotFoundError: No module named 'card'
ModuleNotFoundError: No module named 'card'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'card' How to remove the ModuleNotFoundError: No module named 'card' error
What is Java Card ?
What is Java Card ?  hii, What is Java Card ?   hello,ADS_TO_REPLACE_1 The Java Card specification allows Java technology to run on smart cards and other small devices
validation
Validation method valid the in put. otherwise call the javascript onsubmit to check... code.Ok if you use struts then you can use Validation method valid the in put
Validation
); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel=new JPanel(); panel.add(scroll); JFrame frame=new JFrame("JTable validation
validation
validation  please help me to check validation for <form> <table class="form"> <tr> <td class="col1"> <label>Sno:</label> </td> <td
Problem in card demo example.
Problem in card demo example.  Hi, I have successfully shows... one card of bunch, then its shows back of its above card, hence the top most card is the one card that shows full when drag and move around the screen. please
loyality application
loyality application  Loyalty Application XYZ Bank is a leading public sector bank in India and has recently launched a credit card in alliance with Visa. The credit card industry in India is currently cluttered with many cards
ModuleNotFoundError: No module named 'scikit-credit'
ModuleNotFoundError: No module named 'scikit-credit'  Hi, My... 'scikit-credit' How to remove the ModuleNotFoundError: No module named 'scikit-credit' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'git_credit'
ModuleNotFoundError: No module named 'git_credit'  Hi, My Python... 'git_credit' How to remove the ModuleNotFoundError: No module named 'git_credit' error? Thanks   Hi, In your python environment you
Validation
Validation  I am developing a standalone application which requires me to save the email id and contact number (mobile number) in a database (MySQL). How do i perform a check using JAVA on the data before storing
Problem in show card in applet.
Problem in show card in applet.  The following link contained the card demo with applet. http://www.roseindia.net/java/java... but Not show card in the applet, then I add a code in paintComponent method like
Version of com.braintreepayments>card-form dependency
List of Version of com.braintreepayments>card-form dependency
Version of com.talobin>card-entry dependency
List of Version of com.talobin>card-entry dependency
ModuleNotFoundError: No module named 'card-identifier'
ModuleNotFoundError: No module named 'card-identifier'  Hi, My... named 'card-identifier' How to remove the ModuleNotFoundError: No module named 'card-identifier' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cubicweb-card'
ModuleNotFoundError: No module named 'cubicweb-card'  Hi, My... 'cubicweb-card' How to remove the ModuleNotFoundError: No module named 'cubicweb-card' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'm9s-gift-card'
ModuleNotFoundError: No module named 'm9s-gift-card'  Hi, My... 'm9s-gift-card' How to remove the ModuleNotFoundError: No module named 'm9s-gift-card' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'preview-card'
ModuleNotFoundError: No module named 'preview-card'  Hi, My Python... 'preview-card' How to remove the ModuleNotFoundError: No module named 'preview-card' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pywe-card'
ModuleNotFoundError: No module named 'pywe-card'  Hi, My Python... 'pywe-card' How to remove the ModuleNotFoundError: No module named 'pywe-card' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'report-card'
ModuleNotFoundError: No module named 'report-card'  Hi, My Python... 'report-card' How to remove the ModuleNotFoundError: No module named 'report-card' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'Card-Game'
ModuleNotFoundError: No module named 'Card-Game'  Hi, My Python... 'Card-Game' How to remove the ModuleNotFoundError: No module named 'Card... have to install padas library. You can install Card-Game python with following
ModuleNotFoundError: No module named 'card-identifier'
ModuleNotFoundError: No module named 'card-identifier'  Hi, My... named 'card-identifier' How to remove the ModuleNotFoundError: No module named 'card-identifier' error? Thanks   Hi, In your python

Ads