! This file: http://ftp.aset.psu.edu/pub/ger/fortran/hdk/exchrows.f90 ! Program Exchrows ! Exchange rows of a matrix ! ! by James Van Buskirk, 28 July 2003. real :: A(3,2) integer :: i,j,k,L,nr=3, nt=2 L=0 do I=1,nr do j=1,nt L=L+1 A(i,j)=L end do end do do i=1,nr print *, (A(i,k),k=1,nt) end do print *, ' ' ! ! Exchange rows of matrix, A ! A((/1,3/),:) = A((/3,1/),:) do i=1,nr print *, (A(i,k),k=1,nt) end do end