C
C      Programmer: Kendrick Taylor
C      Course:     CS 430
C      Date Due:   September 12, 2007
C      Language:   Fortran
C      Compiler used: Force 2.0
C      Source Filename: KTaylorLab2a.f
C      Executable Filename (if any) or None: None
C      Professor: Elizabeth Adams
C
C
C       Description of the program's PURPOSE:
C
C       The program converts a decimal number into a binary number
C       the decimal number is an integer
C
C       Description of program's required INPUT:
C
C       An integer in the range 1 - 32767
C
C       Description of program's expected OUTPUT:
C
C       Echoed decimal value and binary value
C
C       Descriptions of any MODIFICATIONS made in debugging the program:
C
C       Added a $ to the format statements so the output would stay on
C       the same line.
C
C       General COMMENTS about the PROGRAM
C
C       No error checking is performed
C
C       General COMMENTS explaining syntax or features of the LANGUAGE
C
C       The only thing that I really learned about the language is the
C       use of the $ in format statements.  the $ is used in FORTRAN
C       to keep a write statement from ending with a newline.  This
C       was a pivotal feature in my binary conversion algorithm.
C
        LENINT = 10
        IFACTOR = 0
        WRITE (6, 20)
        READ (5,30) INT
        WRITE (6, 25) INT
        WRITE (6, 26)
        DO 10 I = LENINT, 0, -1
         IFACTOR = 2 ** I
         ITEST = INT - IFACTOR
         IF (ITEST .GE. 0) GOTO 100
         WRITE (6, 50)
         GOTO 10
  100    WRITE (6, 51)
         INT = INT - IFACTOR
  10    CONTINUE
  50    FORMAT ($,'0')
  51    FORMAT ($,'1')
  20    FORMAT(/$, 'INPUT INTEGER (1 - 32767): ')
  25    FORMAT(/$, 'INTEGER INPUT: ', I5)
  26    FORMAT(//$, 'BINARY REPERSENTATION: ')
  30    FORMAT(I5)
        STOP
        END
