C     Programmer: Wesley Wenger
C     Course: CS 430
C     Date Due: September 12, 2007
C     Language: FORTRAN
C     Compiler used: FORCE2.0.8
C     Source Filename: P2partA
C     Executable Filename (if any) or None: P2partA
C     Professor: Elizabeth Adams
C     Purpose: To convert base 10 to binary base 2
C     Input: An Integer
C     Output:  The output will be the original number and its binary
C     equivalent
C     Language  Information
C     All the variables in ths program are real because their names begin
C     with letters A-H, or O-Z the variables don't need to be declared
C     because they are by default real
C     WRITE is the output statement
C     6 in WRITE (6,_) is the default output device
C     the numbers after  6,  in the WRITE statements are the labels for
C     the related FORMAT statements
C     FORMAT statements are not executable and may be placed anywhere in the program
C     The F format indicates a real number is to be output.
C     The 2nd number after the F in the FORMAT statement indicates numer of
C     places after the decimal point
C     The STOP statement ends the program execution
C     The END statement marks the end of a compilation unit

C     PART A - Takes in an integer in base ten and converts it to base 2
C     by using the mod function and assigning the remainder to an array.

C     The array that will hold the base 2 value
      INTEGER IARRAY(100)

C     Prompts the user for a value and takes in that value
      WRITE (6, 1) "Enter a number in base 10: "
  1   FORMAT (1X, A27)
      READ (5,2)  INPUT
  2   FORMAT (I20)
  
C     Prints the original value and the header
      WRITE (6,3) 'The base 10 value of the input is: ',INPUT
  3   FORMAT (///1X, A35,I5)
      
C     Do Loop used to find the base 10 value.  IARRAY is the array where
C     the value will be stored. ICOUNT is the counter so that the values
C     will be put in the right place. INPUT is the value input by the
C     user.
      IARRAY(1) = MOD(INPUT,2)
      ICOUNT = 2
      DO 4
         IF(INPUT.EQ.1) GOTO 6
         INPUT = INPUT/2
         IARRAY(ICOUNT) = MOD(INPUT,2)
         ICOUNT = ICOUNT + 1
   4  CONTINUE
   
C     Writes the values of the array with the header
   6  WRITE (6,7) 'The base 2 value of the input is: ',
     C(IARRAY(I), I = ICOUNT-1,1,-1)
   7  FORMAT(1X, A34, 15I1)
      STOP
      END








