! 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 3.2. Square root with test for negative argument.
  program D02
    implicit none
    real :: Next_Datum
! start program D02
    write (unit = *, fmt = *) " Please enter a number whose square root is wanted. "
    read (unit = *, fmt = *) Next_Datum
    if (Next_Datum >= 0.0) then  ! Choose "then" block or "else" block.
      write (unit = *, fmt = *) sqrt( Next_Datum )
    else
      write (unit = *, fmt = *) " Can't find the square root of a negative number "
    end if
    stop
  end program D02
