! 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 5.12. Rank of array sections.
  program F12
    implicit none
    real, dimension(3, 3) :: A, B
! start program F12
    A = 1.0
    B = 3.0
    A(2, :) = 0.0   ! Put zeros in second row of A.
    B(:, 2) = A(2, :)   ! Row of A goes into column of B.
    B(:, 2: 2) = A(:, 1: 1)   ! 3 by 1 matrices
    write (unit = *, fmt = *) B(: : 2, :)   ! Rows 1 and 3 of B
    A(:, :) = B   ! Two equivalent statements
    A(1:3, 1:3) = B(:, :)
    write (unit = *, fmt = *) A, B
    stop
  end program F12
