Fortran Wiki
Validate Credit-Debit card Fortran program

Credit cards. Nearly everybody has at least one. Its not wrong to say that credit cards are life lines of worlds financial system.

But how many of you know what those numbers really mean? Contrary to what you may think, they aren’t random. Those 16 digits are there for a reason and, knowing a few simple rules, we can actually learn a lot about a credit card just from its number.

Head to this infographics to crack that code. And check the below mentioned Fortran program to Validate any credit and debit card number.

      PROGRAM CREDITCARD
! Program to Validate a credit or debit card number
! coded by Sukhbinder Singh
! based on http://www.mint.com/blog/trends/credit-card-code-01202011/
      CHARACTER (LEN=16) CCN
      INTEGER ICCN(16),ODD(8),EVN(8)
      WRITE(*,'(A)',ADVANCE='NO')"ENTER YOUR CREDIT CARD NO : "
      READ(*,'(A16)') CCN

      DO I=1,16
        READ(CCN(I:I),'(I1)') ICCN(I)
      END DO
      ODD=ICCN(1:16:2)
      ODD=ODD*2
      CALL SUMODD
      EVN =ICCN(2:16:2)
      IF(MOD(SUM(EVN)+SUM(ODD),10) .EQ. 0) THEN
         WRITE(*,*) "THE CREDIT OR DEBIT CARD NO IS VALID!"
      ELSE
         WRITE(*,*) "THE CREDIT OR DEBIT CARD NO IS INVALID!"
      END IF

      CONTAINS
       SUBROUTINE SUMODD
	     DO I=1,8
	       IF(ODD(I) .GE. 10) THEN
             K=ODD(I)-10
             ODD(I)=1+K		  
	       END IF
	     ENDDO
       END SUBROUTINE

      END PROGRAM