next up previous
Next: Structures Up: Sample programs Previous: Sample programs

Types

  program different_types

      Implicit none
      Real X, Y
      Integer A, B
      Real pi
      Parameter(PI=3.141592653)

      X = 2 * PI
      Y = X**2
      A = Y
      B = Y / 100
      write(*,*) PI, X, Y, A, B

      X = PI / 10
      A = PI
      B = A / 10
      write(*,*) X, A, B

      write(*,*) 'Please input a data item: '
      read(*,*) X
      Y = X / 10
      write(*,*) X,Y
      write(*,10)
      read(*,*) X
      Y = X / 10
      write(*,20) X,Y
10    format('Please input another data item: ',$)
20    format('','The input was',f12.7,' the output is',f12.7)

      end



E. Bruce Pitman
Tue Sep 15 18:15:17 EDT 1998