      program projectile
C 
      real speed,angle,dist,height
      real rnge,max_height
      common /constants/ g,pi
C
C Define constants (pi and acceleration due to gravity (m/s^2))
C
      g = 9.81
      pi = 3.141592654
C
C Define speed (m/s) and angle (degrees) 
C
      speed = 10.
      angle = 30.
C
      dist = rnge(speed,angle)
      height = max_height(speed,angle)
      write (6,*) 'the range of the projectile is ',dist,' m'
      write (6,*) 'its maximum height is ',height,' m'
      stop 
      end
 
C calculate the range of the projectile
C
      function rnge(v,theta)
      real v,theta,rnge,g,pi,theta_rad
      common /constants/ g,pi
C degrees to radians
      theta_rad = theta*pi/180.
      rnge = v**2 * sin(2*theta_rad) / g
      return
      end
 
C calculate the maximum height of the projectile
C
      function max_height(v,theta)
      real v,theta,max_height,g,pi,theta_rad
      common /constants/ g,pi
C degrees to radians
      theta_rad = theta*pi/180.
      max_height = (v * sin(theta_rad))**2 / (2. * g)
      return
      end
