This program takes credit/debit card number as an input through standard input. Then it checks (see the condition used in program below) if the card is valid or not. If it is valid, it prints out the type of card.
The type of card is determined by the initial digit(s) of the credit card number. Also, for validation, it uses Luhn algorithm. For more about the checksum or Luhn algorithm check the wikipedia entry which explains it further in detail.