! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 2.3. Assignment statements with arithmetic expressions.
  program C03
    implicit none
    real, parameter :: GRAVITY = 9.8
    real :: Old_Vol, Old_Press, Old_Temp, New_Vol, New_Press, New_Temp
    real :: Mass, Velocity, Kinetic_Energy, Pressure, Density, Height, Bernoulli
    integer, parameter :: J = 6
    integer :: I
! start program C03
    I = J + 1
    write (unit = *, fmt = *) I
    read (unit = *, fmt = *) Old_Vol, Old_Press, Old_Temp, New_Press, New_Temp
    New_Vol = Old_Vol * (Old_Press / New_Press) * (New_Temp / Old_Temp)
    write (unit = *, fmt = *) Old_Vol, Old_Press, Old_Temp, New_Vol, New_Press, New_Temp
    read (unit = *, fmt = *) Mass, Velocity
    Kinetic_Energy = 0.5 * Mass * Velocity ** 2
    write (unit = *, fmt = *) Mass, Velocity, Kinetic_Energy
    read (unit = *, fmt = *) Pressure, Density, Velocity, Height
    Bernoulli = Pressure + Density * (0.5 * Velocity ** 2 + GRAVITY * Height)
    write (unit = *, fmt = *) Pressure, Density, Velocity, Height, Bernoulli
    stop
  end program C03
